How do you add extra html after an element with jQuery?
I'm aware of jQuery's append() which appends html inside the selected element. I want to add more html after the selected element. For instance:
<a href="/somewhere/">Somewhere</a>
I want to add the html <h3>Hello</h3>
after the above to become:
<a href="/somewhere/">Somewhere</a>
<h3>Hello</h3>
How can you achieve that in jQuery?
after
To address your problem, here is the full code:
$('a[href=desired_url]').after('<h3>Hello</h3>');
精彩评论