Retrieving HTML data-attributes using jQuery
Use the jQuery .data()
function:
var speed = $("yourdiv").data("ts-speed");
You should be able to use the .attr function:
var speed = $("yourdiv").attr("data-ts-speed");
this shoud give you a idea how
html:
<div class="sm-tot" data-ts-speed="500" data-ts-interval="4000" data-ts-newVal="5000" > </div>
js:
$(document).ready(function(){
var speed = $("div.sm-tot").data("ts-speed");
var interval = $("div.sm-tot").data("ts-interval");
$("div.sm-tot").append("speed: " + speed + "<br />");
$("div.sm-tot").append("interval: " + interval + "<br />");
});
<div class="sm-tot" data-ts-speed="500" data-ts-interval="4000" data-ts-newVal="5000" >
well, for this div u can get someone attr with jquery using code like this first follow this pattern
if is Class $(".ClassName").attr('AttrName');
if is Id $('#IDname').attr('attrName')
if u wan get "data-ts-interval" u will use $('.sm-tot').attr("data-ts-interval");