jQuery .prepend()

jQuery .prepend() inserts content to the beginning of the target; difference between .prepend() and .prependTo();

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

Leave a Reply

Your email address will not be published. Required fields are marked *