什么是jquery中的自定义属性... [英] What are custom attribute in jquery ...
本文介绍了什么是jquery中的自定义属性...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人可以给我一个exaple!
解决方案
html对象可以有你想要的任何属性。
< a id = myLink href = somePage.aspx myattribute = test > < / a >
在jQuery中你可以通过
( #myLink)。attr( myAttribute, NewValue );
并且可以获得属性
var attr =
( #myLink )。attr( myAttriubte);
can someone gives me an exaple!
解决方案
html objects can have any attribute you want.
<a id="myLink" href="somePage.aspx" myattribute="test"></a>
In jQuery you can set that attribute by
("#myLink").attr("myAttribute", "NewValue");
and can get the attribute with
var attr =
("#myLink").attr("myAttriubte");
这篇关于什么是jquery中的自定义属性...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文