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

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -