Change Class of input element with using id
Possible Duplicate:
Change an element's CSS class with JavaScript
How can I change the class of <input type="submit:>
not using the id, just the class in Javascript. I have have tried this (with no luck):
function changeClass(){
document.getElementById("wpsc_buy_button").setAttribute("class", "btn btn-success");
}
$('.originalClass').addClass('newClass')
Why would this not work?
you can also do
$('.originalClass').addClass('newClass').removeClass('originalClass');
链接地址: http://www.djcxy.com/p/25220.html上一篇: JavaScript动态添加和删除类
下一篇: 使用id更改输入元素的类