大佬教程收集整理的这篇文章主要介绍了使用jQuery迭代元素属性,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
<items> <item id="id123" name="Fizz" value="Buzz" type="xyz"> <subitem name="foo"> <subitem name="bar"> </item> <item id="id456" name="Bizz" value="Bazz" type="abc"> <subitem name="meh"> <subitem name="hem"> </item> </items>
我已经能够迭代的项目与…
$(xml).find('item').each(function() { // Do something to each item here... });
但我想能够得到一个属性数组的每个’项目’,@R_31_9447@重复这些…
例如
$(xml).find('item').each(function() { var attributes = $(this).attributes(); // returns an array of attributes? for (attribute in attributes) { // Do something with each attribute... } });
我在这里做了一些搜索,在jQuery文档,和其他地方通过谷歌,但没有运气。如果没有别的,我可能只是有麻烦排除与jQuery对象的attr()方法相关的结果。提前致谢。
以上是大佬教程为你收集整理的使用jQuery迭代元素属性全部内容,希望文章能够帮你解决使用jQuery迭代元素属性所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。