使用jQuery操作自定义值 [英] Manipulate Custom Values with jQuery
本文介绍了使用jQuery操作自定义值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个图像,我需要更改U数据类型的值。 U数据由我正在使用的开发人员实施,我需要能够使用jQuery在指定的时间轴上每15秒更改一个循环中的值。
我可以弄清楚循环部分,但是我只是想看看是否有办法使用jQuery操作u值。
解决方案
尝试
setInterval(function(){
var val = $('#button4')。attr('u')。substring(6);
$('#button4')。attr('u' ,'按钮'+(1 + + val))
},1000)
演示:小提琴
<img src="" class="className" click="" id='button4' u="button6" r="button5" l="ele1" d="" />
I have an image wherein I need to change the value of the "U" data type. The "U" data was put in place by a developer I am working with, and I need to be able to use jQuery to change it's value in a loop on a specified timeline of every 15 seconds.
I can figure out the loop part, but I was just wanting to see if there is a way to manipulate the "u" value using jQuery.
解决方案
Try
setInterval(function(){
var val = $('#button4').attr('u').substring(6);
$('#button4').attr('u', 'button' + (1 + +val))
}, 1000)
Demo: Fiddle
这篇关于使用jQuery操作自定义值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文