- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
HTML5 data-* attribute type casting strings and numbers
For data-attribute typecasting of Numbers and String, use −
[...document.querySelectorAll("a")].forEach(a => console.log("type: %s, value: %o", typeof a.dataset.value, a.dataset.value) );
The above is for the following data-attributes −
<a data-value = "6.0">6.0</a> <a data-value = "6.5">6.5</a>
Advertisements