I want to do he following, but it does not work:
if(pathname == \'/ik/services/\' || \'/ik/recruitment/\'){
//run function
}
It is compl
try doing
if(pathname == '/ik/services/' || pathname == '/ik/recruitment/'){
//run function
}
Try this:
if((pathname == '/ik/services/') || (pathname == '/ik/recruitment/')){
//run function
}
You would have to do something like this:
if(pathname == '/ik/services/' || pathname == '/ik/recruitment/'){
//run function
}
Your || '/ik/recruitment/'
would always be truthy, and therfor the code within your if-statement will always run.
This has nothing to do with jQuery, it's just a normal JS "error". You need to compare both strings with the variable:
if (pathname == 'foo' || pathname == 'bar')
Try
if(pathname == '/ik/services/' || pathname == '/ik/recruitment/'){
OR
jQuery inArray
Example
var arr = ['/ik/services/','/ik/recruitment/'];
if($.inArray(pathname , arr) !== -1)