Multiple Parameters for jQuery selector? -
i looking @ jqueryui button plug-in , noticed this
$("button, input:submit, a", ".demo").button();
i never seen this. multiple selects in 1 jquery selector?
the second argument (".demo"
in example) context, selector restricted match descendants of determined context:
$(expr, context)
is equivalent use find
method:
$(context).find(expr)
give documentation of jquery function:
selector context
by default, selectors perform searches within dom starting @ document root. however, alternate context can given search using optional second parameter
$()
function. example, if within callback function wish search element, can restrict search:
$('div.foo').click(function() { $('span', this).addclass('bar'); // find span elements // descendants of clicked element (this) });
also notice selector post "button, input:submit, a"
, called multiple selector, , there can specify number of selectors combine single result, separating them comma.
Comments
Post a Comment