$('element').length == 0
if($('div#mydiv').length == 0) { $('body').append(' <div id="mydiv">hello world!</div> '); } else { $('div#mydiv').html('hello universe!'); }
No comments:
Post a Comment