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

apache - setting document root in antoher partition on ubuntu -

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

Process 'command 'F:\android-sdk\build-tools\21.1.2\aapt.exe'' finished with non-zero exit value 1 -