Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
DataAttribute vs Class Selector vs ID Selector / JQuery
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (iPhone; CPU iPhone OS 18_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/130.0.6723.90 Mobile/15E148 Safari/604.1
Browser:
Chrome Mobile iOS 130
Operating system:
iOS 18.1
Device Platform:
Mobile
Date tested:
one year ago
ID
4.3M/s
Class
2.2M/s
data attribute
1.4M/s
View exact numbers
Test name
Executions per second
✓
ID
4,278,410 Ops/sec
Class
2,163,874 Ops/sec
data attribute
1,381,483 Ops/sec
HTML Preparation code:
<div class="hello" id="hello" data-hello>Hello</div> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js'></script>
Tests:
Class
$('.hello');
ID
$('#hello');
data attribute
$('[data-hello]');