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

Revision 4 of this benchmark created by mark on


Preparation HTML

<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.js"></script>
<input type="checkbox" value="y" name="my-test-checkbox" id="my-test-checkbox" checked>
<script>
  var $el = $('#my-test-checkbox');
</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
.getAttribute('checked')
$el[0].getAttribute('checked');
ready

Revisions

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