Getting ID with jQuery or without

Benchmark created by Matthieu R on


Description

Testing get(0).id or attr('id')

Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<div id="myEl"></div>

Test runner

Ready to run.

Testing in
TestOps/sec
with jQ
$('div:first').attr('id');
ready
without jQ
$('div:first').get(0).id;
ready

Revisions

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