Reputation: 5463
I have an number of achor elements, how to loop through each and add a
tag ?
it's like this,
<a id="fbutton" href="http://www.facebook.com" title="fb" name="fb[]">
<img alt="fb" src="/images/icons/fb.jpg">
</a>
why do i want to add a br tag, because this button is too close to another button with another array name
Upvotes: 0
Views: 2591
Reputation: 9413
Try this , no looping is required ..
$("a").after("<br/>");
For reference http://api.jquery.com/after/
Upvotes: 2
Reputation: 1386
Give all a
elements you want to loop through a class
, then use:
$("a.classyougavethem").after("<br/>");
Upvotes: 1