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

Benchmark created by Warren Parsons on


Preparation HTML

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

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

Test runner

Ready to run.

Testing in
TestOps/sec
.attr()
var x = $('#testinput').attr('value');
ready
.prop()
var x = $('#testinput').prop('value');
ready

Revisions

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