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

Revision 17 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/jquery.min.js"></script>
<div id="content">
<form method="post" action="/">
<h2>Traffic Light</h2>
<ul id="traffic_light">
<li><input type="radio" class="on" name="light" value="red" /> Red</li>
<li><input type="radio" class="off" name="light" value="yellow" /> Yellow</li>
<li><input type="radio" class="off" name="light" value="green" /> Green</li>
</ul>
<input class="button" id="traffic_button" type="submit" value="Go" />
</form>
</div>

Test runner

Ready to run.

Testing in
TestOps/sec
Id select
var traffic_button = $('#content .button');
ready
class select
var traffic_button = $('#traffic_button');
ready

Revisions

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