jQuery prop('checked') vs. is(':checked') (v19)

Revision 19 of this benchmark created on


Description

A quick test to see if prop('checked') or is(':checked') is faster with jQuery.

Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>

<input type="radio" value="y" name="my-test-radiobutton" id="my-test-radiobutton" checked>
<script>
  var $el = $('#my-test-radiobutton');
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
.prop()
$el.prop('checked');
ready
.is(':checked')
$el.is(':checked');
ready
attr("checked")
$el.attr("checked");
ready
.checked
$el[0].checked;
ready
.get(0).checked
$el.get(0).checked;
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.