久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      jquery中each的用法是什么

      用法:1、用于為每個匹配元素規(guī)定運(yùn)行的函數(shù),語法為“$(selector).each(function(index,element))”;2、用于遍歷指定的對象和數(shù)組,語法為“$.each(需要遍歷的對象或數(shù)組,用于循環(huán)執(zhí)行的函數(shù))”。

      jquery中each的用法是什么

      本教程操作環(huán)境:windows10系統(tǒng)、jquery3.2.1版本、Dell G3電腦。

      jquery中each的用法是什么

      1、each() 方法規(guī)定為每個匹配元素規(guī)定運(yùn)行的函數(shù)。

      提示:返回 false 可用于及早停止循環(huán)。

      $(selector).each(function(index,element))

      function(index,element)必需。為每個匹配元素規(guī)定運(yùn)行的函數(shù)。

      示例如下:

      <html> <head> <script type="text/javascript" src="/jquery/jquery.js"></script> <script type="text/javascript"> $(document).ready(function(){   $("button").click(function(){     $("li").each(function(){       alert($(this).text())     });   }); }); </script> </head> <body> <button>輸出每個列表項(xiàng)的值</button> <ul> <li>Coffee</li> <li>Milk</li> <li>Soda</li> </ul> </body> </html>

      輸出結(jié)果:

      jquery中each的用法是什么

      點(diǎn)擊按鈕后:

      jquery中each的用法是什么

      2、jQuery.each() 函數(shù)用于遍歷指定的對象和數(shù)組。

      語法

      $.each( object, callback )

      object Object類型 指定需要遍歷的對象或數(shù)組。

      callback Function類型 指定的用于循環(huán)執(zhí)行的函數(shù)。

      示例如下:

      <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>123</title> <script src="js/jquery.min.js"></script> </head> <body> <script> $(function () {  $.each([52, 97], function(index, value) {   alert(index + ': ' + value); }); }) </script>   </body> </html>

      輸出結(jié)果:

      jquery中each的用法是什么

      jquery中each的用法是什么

      相關(guān)視頻教程推薦:jQuery視頻教程

      贊(0)
      分享到: 更多 (0)
      ?
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號