jQuery().prop vs jQuery().val (v50)

Revision 50 of this benchmark created on


Description

if so (el = document.getElementById('el'))

try this :D

Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<input id="el" value="stuff" />
<script>
  var i = 0,
      el = document.getElementById('el'),
      $el = $(el);
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
jQuery.fn.val
$el.val();
ready
jQuery.fn.prop
$el.prop('value');
ready
JS
el.value
ready
JS getAttribute
el.getAttribute('value')
ready

Revisions

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