The second argument ( ".demo" in your example) is the context, basically your selector is limited to match only the descendants of the specific context:
$(expr, context)
This is simply equivalent to using the find method:
$(context).find(expr)
Take a look at the jQuery function documentation:
Selector context
By default, selectors perform their search in the DOM, starting at the root of the document. However, an alternative context can be set to search using the extra second parameter in the $() function. For example, if inside the callback function we want to search for an element, we can limit this search:
$('div.foo').click(function() { $('span', this).addClass('bar');
Also note that the selector you send "button, input:submit, a" is called the Multiple Selector , and there you can specify any number of selectors to combine into a single result, just separating them with a comma.
CMS Apr 20 2018-10-10T00: 00Z
source share