$().each vs $.each vs for loop in jQuery?

后端 未结 3 1452
北海茫月
北海茫月 2020-11-27 18:13

I Can\'t understand why it is happening.

I read here that :

The first $.each constitutes a single function

3条回答
  •  孤城傲影
    2020-11-27 19:04

    Different approach to your "task" http://jsfiddle.net/ADMnj/17/

    But i guess the performance issues are coming from that you dont state selector the in the right matter

    #t tr input:checkbox:checked 
    
    VS
    
    #t tr :checkbox:checked 
    

    Tough the right way to check if a checkbox is checked would be to call it like this

    #t tr input[checked="checked"]
    

    W3.ORG's selector list see the E[foo]

    And last but not least the fastest is also the one with the shortest code which might be the slight performance different you get from 3 lines vs 4 and 5 lines of code but cant prove this fact

提交回复
热议问题