1.

How to iterate/loop through all p elements in jquery.

Answer»

$.each() is an object iterator tool provided by jQuery, as is.each(), a jQuery collection iterator(). So for traversing all the p elements, the sample code is -

$("p").each(function() {
console.log( $(this).attr('id'));
});


Discussion

No Comment Found