Javascript JQuery在页面加载时更改按钮类,其中value=myValue
这是我的HTML代码Javascript JQuery在页面加载时更改按钮类,其中value=myValue,javascript,jquery,html,Javascript,Jquery,Html,这是我的HTML代码 <input type="button" class="green red" value="Open"/> <input type="button" class="red yellow" value="Close"/> <input type="button" class="orange red" value="Close"/> <input type="button" class="blue red bl
<input type="button" class="green red" value="Open"/>
<input type="button" class="red yellow" value="Close"/>
<input type="button" class="orange red" value="Close"/>
<input type="button" class="blue red black" value="Close"/>
我想在加载页面时使用JQuery更改按钮的样式类
要求:对于具有值“关闭”按钮的样式类,红色应替换为绿色
注意:我无法更改上述代码,因为它是自动生成的
请告诉我如何在使用JQuery/Java脚本加载页面时更改样式
jQuery(function($){
$('input.red:button[value="Close"]').removeClass('red').addClass('green')
})
试一试
$('input.red:button[value=“Close”]).removeClass('red').addClass('green')$('input.red:button[value=“Close”]).removeClass('red').addClass('green'))实际上他说的是“加载页面时”。实际上他说的是“加载页面时”。