Search code examples
jquerycommentsnestedselectorquotes

Is this legal in jQuery?


Is it legal in jQuery to place a comment in the middle of a chained query?

$('#deForm :input')
    .not('.notHide')  //Commment
    .not('.alsoNotHide');

I am testing a code like this but it has a strange behavior, and I would like to be sure, its not a refresh issue because for me theres no change in behavior.

Also is it preferable to use single quotes or double quotes for selectors?


Solution

    1. yes its legal to have comments like that.
    2. usually, it doesnt matter which quotes you use. See accepted answer here