I am using the following to access specific DOM elements with the placeholder "Serial"
$('input[placeholder=Serial]')
And it's working fine. I have some other DOM elements having placeholder of "@SAL"
, when I try to access them using:
$('input[placeholder=@SAL]')
It throws this error
Error: Syntax error, unrecognized expression: input[placeholder=@SAL]
But when I try to access the same using double quotes "
around @SAL
it's working fine.
Now the question is, why does $('input[name=Serial]')
work fine i.e. without the double quotes around the placeholder value but $('input[placeholder=@SAL]')
throw the above said error?
P.S I know it's a bad idea to access DOM elements based upon their placeholders (as they may change), but I was just curious that why is it not working in this specific case...