Answers for "get element with data id from div"

0

jquery get data-id

const dataId = $('#elementId').attr("data-id");
Posted by: Guest on August-13-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

Code answers related to "get element with data id from div"

Code answers related to "Javascript"

Browse Popular Code Answers by Language