javascript - How to check if element exists after the current element with jQuery? -


i need check following

if after $('.brandmodellinewrapper') there isn't clearfix div, add it: $('.brandmodellinewrapper').after("<div class='clear'></div>")

how that?

you can use .next() :is selector check if div class clear. , can use .after() or insertafter() append clear div based on first condition:

 if(!$('.brandmodellinewrapper').next().is('div.clear')){      $('.brandmodellinewrapper').after("<div class='clear'></div>");  } 

Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -