jQuery checkbox tests (v9)

Revision 9 of this benchmark created on


Description

Please, use Javascript properties when appropriate. As you can tell they are fast. :-)

Preparation HTML

<script src="//code.jquery.com/jquery-1.6.min.js"></script>
<form>
 <input type="checkbox" id="abc" />
</form>

<script>
  abc = $("#abc");
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
direct property
abc[0].checked
ready
$(abc).is(":checked")
abc.is(":checked")
ready
$(abc).prop("checked")
abc.prop("checked")
ready
!!$(abc).attr("checked")
!!abc.attr("checked")
ready

Revisions

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