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
Post a Comment