jQuery and “Organized Code”

后端 未结 8 1800
星月不相逢
星月不相逢 2020-12-12 11:52

I\'ve been struggling lately with understanding the best way to organize jQuery code. I asked another question earlier and I don\'t think I was specific enough (found in thi

8条回答
  •  南笙
    南笙 (楼主)
    2020-12-12 12:33

    Just want to add to what was mentioned previously that this:

    $.each(container.children(), function(j,w) {
        $(w).unbind().change(function() { ... });
    });
    

    can be optimized to:

    container.children().unbind().change(function() { ... });
    

    It's all about chaining, a great way to simplify your code.

提交回复
热议问题