Get Attribute value

Benchmark created by Asa Williams on


Description

Getting the attribute value when the element object is already known.

Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<input id="test" name="test" />
<script>
  var test = document.getElementById('test');
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Using jQuery
var name = $(test).attr('name');
ready
JavaScript
var name = test.name;
ready

Revisions

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

  • Revision 1: published by Asa Williams on