⊗jqDmBMU 54 of 113 menu

Using the before method in jQuery

The before method allows you to add text to tags before elements.

For example, there is the following paragraph:

<p>text</p>

Now, let's add tags with text:

$('p').before('<b>!!!</b>');

HTML the code will look like this:

<b>!!!</b><p>text</p>

Before each h2 insert '<p>!</p>'.

byenru