Setting value of jQuery form element (v9)

Revision 9 of this benchmark created on


Preparation HTML

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

<input id="foo" type="hidden">

Setup

var value = Math.random();
    var $el = $('#foo');

Test runner

Ready to run.

Testing in
TestOps/sec
$el.val
$el.val(value);
ready
$el[0].value
$el[0].value = value;
ready
$el.prop
$el.attr("value", value);
ready
$el.prop
$el.prop("value", value);
ready

Revisions

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