javascript - $(':checkbox') or $('input[type="checkbox"]') -


which method best select checkbox using jquery , why?

$('input:checkbox'); // 1 $('input[type="checkbox"]'); // 2 

well, according jquery docs:

because :checkbox jquery extension , not part of css specification, queries using :checkbox cannot take advantage of performance boost provided native dom queryselectorall() method. better performance in modern browsers, use [type="checkbox"] instead.


Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -