javascript - how to using "For" instead of "each" function in jquery -


Today I am stacked with lots of work and Juke. I got it for one morning but I can not solve it :(. Here's my job:

  

gt; & lt; p class = "test"> & lt; / div & gt;

In general, i can use jQ for each function for select all & Lt; p class = "test"> EX:

  $ ("test"). Each (function () { $ (This) .text ('a');});  

But I have heard that everyone, f The function gets less timeload than the each function. I now want to use instead of every but I do not want to write code jQ in this case

Someone can help me! Thanks!

I will not be worried about this unless you reach hundreds of them.

for loop is usually a normal DOM (without a jacket aka) trailer, like ...

  var element = document.getElementById ('some'). GetElementsByTagName ('A'); Var Elements = Thin element Long; For (var i = 0; i   

elementsLength is a good idea, so it does not count every recurrence. Thanks for the suggestion in the comments.

If you want to do it with jQuery, then just customize it for your jQuery object.

Change elements with variables your jQuery archive, such as $ ('# something a') . I think you might need to wrap the object again if you have to do more jQuery content with it.


Comments