Setting value of jQuery form element (v8)

Revision 8 of this benchmark created on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.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(value)
$el.val(value);
ready
$el[0].value = value
$el[0].value = value;
ready
$el.attr("value", value)
$el.attr("value", value);
ready

Revisions

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