I want to loop through all of the paragraph elements in my document and adjust their html. Currently I use some jquery:
console.log("loop through <p> elements");
$("p").each(function()
{
console.log("next <p> element with id: " + this.id);
});
However only "loop through paragraph elements" appears in the console and I have a few paragraph elements with unique ids in my body:
<body>
<p id="para1"> paragraph 1 </p>
<p id="para2"> paragraph 2 </p>
<p id="para3"> paragraph 3 </p>
</body>
I am hoping it is some kind of syntax error with the .each() loop and that someone can correct me, any help would be much appreciated.
element with id: " + $(this).attr('id'));});
– Reza-S4 Dec 15 '14 at 22:14