jQuery afterText Plugin

jQuery has a hard time dealing with text after something you’ve selected. But now it’s easy thanks to the jQuery afterText Plugin. Just change the text after something with the afterText() function:

$('.red').afterText('This is red!');
$('.blue').afterText('This is blue!');

The difference to after(text) is that afterText(text) replaces any existing text (including empty text). It’s so simple! You can grab it on Github.

Related: How to remove text from after an element with jQuery

This entry was posted in Developing, Linked, Pressed and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.