dataset js
for javascript :
webappData.getAttribute('data-id');
document.querySelector('#elementId').dataset.id = 'value';
for jquery :
$(element).attr('data-key', 'value');//html file
<div id="user" data-user-id="2" data-user-date-of-birth="03/03/1993">
<p> Hello ! </p>
</div>
//js file
const user = document.getElementById('user')
console.log(user.dataset.userId) // => 2
console.log(user.dataset.userDateOfBirth) // => '03/03/1993'
Also in JavaScript:
- vs code terminal json object not showing something shows [object]
- react overflow scroll
- javascript object entries
- moment duratuion from hours
- javascript array filter
- javascript appendchild at index
- keyboard close when typing react native
- javascript switch statement multiple cases
- how to use await to console
- javascript generate 3 numbers 1 - 49
- function expression vs function declaration
- Error: It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function.
- resize js
- difference between foreach and map in js
- get css value jquery
- reduce function javascript
- how to hide header in react navigation
- jsdoc optional param
- javascript give class to element
- react Refused to execute inline script because it violates the following Content Security Policy directive
- passing a variable to the width style div angular
- how to create a component in react native
- how to delete an element of an array in javascript
- angular router navigate