1. <tt id="5hhch"><source id="5hhch"></source></tt>
    1. <xmp id="5hhch"></xmp>

  2. <xmp id="5hhch"><rt id="5hhch"></rt></xmp>

    <rp id="5hhch"></rp>
        <dfn id="5hhch"></dfn>

      1. jQuery中delegate()實例用法

        時間:2020-11-11 15:29:09 jQuery 我要投稿

        jQuery中delegate()實例用法

          本文實例講述了jQuery中delegate()方法用法。分享給大家供大家參考。具體分析如下:

          此方法為匹配元素的子元素添加一個或多個事件,并規(guī)定當(dāng)這些事件發(fā)生時運行的函數(shù)。

          語法結(jié)構(gòu):

          復(fù)制代碼 代碼如下:$(selector).delegate(childofselector,type,data,function)

          參數(shù)列表:

          參數(shù) 描述 childofselector 定義要附加事件處理程序的一個或多個子元素。 type 可選。定義附加到元素的一個或多個事件類型。由空格分隔多個事件值。 data 定義傳遞到事件處理函數(shù)的`額外數(shù)據(jù)。 function 定義當(dāng)事件發(fā)生時運行的函數(shù)。

          實例代碼:

          復(fù)制代碼 代碼如下:

          li{

          list-style-type:none;

          width:150px;

          height:150px;

          border:1px solid green;

          }

          $(document).ready(function(){

          $("div").delegate("button","click",function(){

          $("li").slideToggle();

          })

          })

          以上代碼可以div的子元素button元素注冊click事件處理函數(shù),當(dāng)點擊按鈕的時候能夠?qū)崿F(xiàn)隱藏和顯示的切換。

          希望本文所述對大家的jQuery程序設(shè)計有所幫助。

        【jQuery中delegate()實例用法】相關(guān)文章:

        1.jQuery中delegate與on的用法與區(qū)別

        2.JQuery中serialize()用法實例分析

        3.JQuery中Text方法用法實例分析

        4.jQuery中:eq()選擇器的用法實例

        5.jquery獲取css中的選擇器用法實例講解

        6.jQuery中常用的遍歷函數(shù)用法實例

        7.jQuery中replaceAll()方法用法

        8.jQuery中trigger方法用法

        国产高潮无套免费视频_久久九九兔免费精品6_99精品热6080YY久久_国产91久久久久久无码

        1. <tt id="5hhch"><source id="5hhch"></source></tt>
          1. <xmp id="5hhch"></xmp>

        2. <xmp id="5hhch"><rt id="5hhch"></rt></xmp>

          <rp id="5hhch"></rp>
              <dfn id="5hhch"></dfn>