Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何循环所有ul标记并使用JQuery在其上实现函数?_Jquery_Foreach_Css Selectors - Fatal编程技术网

如何循环所有ul标记并使用JQuery在其上实现函数?

如何循环所有ul标记并使用JQuery在其上实现函数?,jquery,foreach,css-selectors,Jquery,Foreach,Css Selectors,如何循环使用特定类名的所有ul标记并在其上实现函数 我试过了,但没用 $("ul.innerContainer").foreach(function(){ //do something with the element }); 它是each()而不是foreach() 方法被调用,而不是foreach 差不多了: $("ul.innerContainer").each(function(){ // do something with '$(this)' }); $('ul.inn

如何循环使用特定类名的所有
ul
标记并在其上实现函数

我试过了,但没用

$("ul.innerContainer").foreach(function(){
  //do something with the element
});
它是
each()
而不是
foreach()

方法被调用,而不是foreach

差不多了:

$("ul.innerContainer").each(function(){
    // do something with '$(this)'
});
$('ul.innerContainer').each(function(index) {
   //function here
});
$("ul.innerContainer").each(function(){
    // do something with '$(this)'
});