when i use append it add an element WITHIN an element. i want to add an element AFTER an element.
eg.
<div class="link">
<input class="link" type="text" value="Skriv länk" />
<br />
</div>
how do i add an element after 'input' but before 'br'?
$("input").after("<p>Hello</p>");
After on jQuery doc: http://api.jquery.com/after/
You also have the insertAfter:
$("<p>Hello</p>").insertAfter("input");
Will work just fine.
Use insertBefore()
or insertAfter()
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With