本文介绍了使用jQuery检索HTML数据属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用jQuery获取存储在数据属性中的值?
How can I get the values stored in the data attributes using jQuery ?
<div class="sm-tot" data-ts-speed="500" data-ts-interval="4000" data-ts-newVal="5000" >
推荐答案
使用jQuery 功能:
Use the jQuery .data()
function:
var speed = $("yourdiv").data("ts-speed");
这篇关于使用jQuery检索HTML数据属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!