Condition To Test If A Word Exists In Window.location.href
I want to test if a word ['sublanguageid-all' to be specific] is present in the current address of the page using an 'if' condition. I've tried /sublanguageid-all/g, but I'm not ab
Solution 1:
Doesn't
if(window.location.href.indexOf('sublanguageid-all') != -1)
work?
Solution 2:
if( location.href.match("sublanguageid-all") ) {
alert('present')
}
Post a Comment for "Condition To Test If A Word Exists In Window.location.href"