Answers for "get data by id javascript"

40

javascript get element by id

var element = document.getElementById("YourElementId");
Posted by: Guest on July-08-2020
0

javascript get data-id attribute

//get data-id attribute in plain Javascript
var element = document.getElementById('myDivID');
var dataID = element.getAttribute('data-id');

//get data-id using jQuery
var dataID = $('myDivID').data('data-id');
Posted by: Guest on July-31-2019
2

how to get an element by id in javascript

document.getElementById("IdGoesHere");
Posted by: Guest on December-04-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language