jquery - If statement to move HTML element -
i have search bar can't recreate. can moved. can move statement:
$('#containertbright').insertbefore('search2');
the problem need statement work on every other page , 1 below work on links.
$('#containertbright').insertbefore('search2');
i created if
statement reason not getting desired result. right way this?
if (window.location.href == 'http://support.com/support/default.asp' || window.location.href == 'http://support.com/support/default.asp?pg=pgoldmainmenu' || window.location.href == 'http://support.com/support/default.asp#') { $('#containertbright').insertbefore('search1'); } else { $('#containertbright').insertbefore('search2'); }
you can add class page need execute else block , write if condition follows. assuming add class exception
body
tag of page.
if ($('body').hasclass('exception')) { $('#containertbright').insertbefore('search2'); } else { $('#containertbright').insertbefore('search1'); }
this should work.
Comments
Post a Comment