I'm having a strange jQuery issue. I'm writing a function that accepts a string as a parameter, and then am feeding that string into a jQuery selector.
Here is the function:
function myFunction(specialfields) {
if(!$(specialfields).is(':focus')) {
alert('thats not in focus');
}
}
However, I keep getting this error:
Uncaught Syntax error, unrecognized expression: focus
What's strange though is that the '.is(':focus') ' works in other areas, when not accepting a parameter, and if I pass this:
$(specialfields)
It does read as valid object. I am trying to pass a string like this:
#id1, #id2
In addition, this works:
$(specialfields).val()
Anyone have any idea whats going here?