jquery,如何在按下按钮后删除按钮颜色?

标签 jquery html css button cgi

<button style="background-color:lightblue" id="extractv">
     <b>
       Extract<br>v
     </b>
</button>      
...

$("#extractv").click(function () {
   $("#extractv").removeAttr("style"); 
});

有人点击按钮后,我想去掉按钮上的背景色。我不确定为什么它不起作用。

谢谢
戈登

最佳答案

尝试使用

.css('background-color','');

关于jquery,如何在按下按钮后删除按钮颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4271079/

相关文章:

javascript - 了解 jQuery 中的 $.proxy()

javascript - 使div按顺序倒退

javascript - Bootstrap 4 滚动到长粘边栏的底部

javascript - 为什么按钮不改变颜色? (如何更改 html 元素的类)

html - Github页面404找不到文件

css - 术语 "css font stack"是什么意思?这个词的意思变了吗?

Javascript 和 JQuery : how to bind the value to DOM element

javascript - Window.onblur - 禁用 iframe 事件

html - 无法在 css 中缩放图像

javascript - 与容器 div 重叠的传单 map