What is the difference between $.each(selector) and $(selector).each()

前端 未结 8 890
夕颜
夕颜 2020-12-07 12:59

What is the difference between this:

$.each($(\'#myTable input[name=\"deleteItem[]\"]:checked\').do_something());

and this:



        
8条回答
  •  南笙
    南笙 (楼主)
    2020-12-07 13:48

    You want to really use $.each with an array that isn't elements or something. ie:

    var x = ["test", "test2"];
    

    You'd use $.each(x... to traverse that instead of x.each :)

    .each is for elements only :)

提交回复
热议问题