Test performance of jQuery .attr() vs. .prop() (v7)

Revision 7 of this benchmark created on


Preparation HTML

<input id="testinput" type="text" name="testme" value="1" />

<script src="//code.jquery.com/jquery-2.1.1.min.js"></script>

Test runner

Ready to run.

Testing in
TestOps/sec
.attr()
$('#testinput').attr('disabled', 'disabled');
$('#testinput').removeAttr('disabled');
ready
.prop()
$('#testinput').prop('disabled', true);
$('#testinput').prop('disabled', false);
ready
vanilla attr
document.getElementById('testinput').setAttribute('disabled', 'disabled');
document.getElementById('testinput').removeAttribute('disabled');
ready
vanilla prop
document.getElementById('testinput').disabled = true;
document.getElementById('testinput').disabled = false;
ready

Revisions

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