getElementById vs. jQuery val()

Benchmark created by Wieland on


Preparation HTML

<label for="action">
  Action:
</label>
<input type="text" id="action" name="action" value="brol" />
<label for="hour">
  Heure:
</label>
<input type="text" id="hour" name="hour" value="brol" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
getElementById
var action = document.getElementById('action').value,
    hour = document.getElementById('hour').value;
ready
jQuery
var action = $('#action').val(),
    hour = $('#hour').val();
ready

Revisions

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