$('div').attr('id', 'new');
#new{ height:250px; width:250px; background:#eee; margin:25px; }
<div class="foo">add ID</div>