Hi all,
I'm trying to use the jquery :contains (or .contains()) selector inside a function, however I can't seem to get it to work.
Basically I'm passing a string to a function and I want to check the variable if it contains X, do something else do something else. If that makes sense.
Here's my code.
function checkMe(myVar) {
if ($(myVar).contains("foo")) {
//do something
} else {
//do something else
}
}
and my call to the function:
checkMe("/foo/bar");
But it's not working. Any help would be appreciated! :)