Dodaj ID jQuery
$('element').attr('id', 'value');
Adventurous Alligator
$('element').attr('id', 'value');
$( "li" ).add( "<p id='new'>new paragraph</p>" )
.css( "background-color", "red" );
<h2>Greetings</h2>
<div class="container">
<div class="inner">
Hello
<p>Test</p>
</div>
<div class="inner">
Goodbye
<p>Test</p>
</div>
</div>
$( ".container" ).append( $( "h2" ) );
var pdiv = $( "p" );
pdiv.add( "div" ); // WRONG, pdiv will not change
$( "li" ).add( document.getElementsByTagName( "p" )[ 0 ] )
.css( "background-color", "red" );