Inserts content, specified by the parameter, before each element in the set of matched elements.
$('.content').before('<h2>Introduction</h2>');
<h2>Introduction</h2>
<div class="content">...</div>
const $icon = $.t('<i>', { class: 'icon-star' });
$('button').before($icon);
<i class="icon-star"></i>
<button>...</button>
| Parameter | Type | Description |
|---|---|---|
| content | string | element | SR | HTML string, DOM element, or SR object to insert before each matched element. |
Returns: The original SR object for chaining.