[Solved] How to disable Script on certain selected page


Its common problem if are using duplicate ids in different scripts.

For egs, if you are using name as id in login script and the same id is used in search script, so definately these 2 would create conflits with the same id name

Now, to reslove this you can have 2 options

  1. Add unique ids to elements or access by using its parent selector like $('#parent_unique_id #name')
  2. Add login script only to login page and search script to search page.

Updated, if you want to check the page and then add/run script then you can use location.href like,

if(location.href.indexOf('login')!==-1) { // for example its login.php page
     // code for login page
}

And do something like for search page.

5

solved How to disable Script on certain selected page