jQuery .before() inserts content before target element; difference between .before() and .insertBefore();
js:
$(function() { $('div').before($('<em>before text - </em>')); $('p').before($('<em>').attr('title', 'text title attr').text('before text with title attr - ')); });
html:
<div>div</div> <p>paragraph</p>