$(function() { $('div').before($('<em>before text - </em>')); $('p').before($('<em>').attr('title', 'text title attr').text('before text with title attr - ')); });
<div>div</div> <p>paragraph</p>