本文介绍了如何更改几个提交按钮的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要脚本,它会改变提交按钮的值,像所有按钮的加载...一样。
我需要完整的jQuery或Javascript脚本。 b
解决方案
这是一个小提琴:
HTML:
< input type =submit/>
< input type =submit/>
< input type =submit/>
< input type =submit/>
< input type =submit/>
JavaScript:
var btns,i,i2;
btns = document.querySelectorAll(input [type ='submit']); $(i = 0; i< btns.length; i ++){
btns [i] .addEventListener(click,function(){
for(i2 = 0; i2 btns [i2] .value =loading ...;
}
});
}
How I can rename all submit buttons when I'm clicking on it?
I need script, which will change submit button's value to smth like "Loading..." for all buttons.
I need full jQuery or Javascript script.
解决方案
Here's a fiddle: http://jsfiddle.net/7EJGd/2/
HTML:
<input type="submit"/>
<input type="submit"/>
<input type="submit"/>
<input type="submit"/>
<input type="submit"/>
JavaScript:
var btns, i, i2;
btns = document.querySelectorAll("input[type='submit']");
for (i = 0; i < btns.length; i++) {
btns[i].addEventListener("click", function() {
for (i2 = 0; i2 < btns.length; i2++) {
btns[i2].value = "loading...";
}
});
}
这篇关于如何更改几个提交按钮的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!