如何刪除添加了.css()函數的樣式? - How can I remove a style added with .css() function?

問題:

I'm changing CSS with jQuery and I wish to remove the styling I'm adding based on the input value: 我正在用jQuery更改CSS,我但願根據輸入值刪除我添加的樣式: css

if(color != '000000') $("body").css("background-color", color); else // remove style ?

How can I do this? 我怎樣才能作到這一點? Note that the line above runs whenever a color is selected using a color picker (ie. when mouse moves over a color wheel). 請注意,只要使用顏色選擇器選擇顏色(即鼠標在色輪上移動時),就會運行上面的一行。 函數

2nd note: I can't do this with css("background-color", "none") because it will remove the default styling from the css files. 第二個注意事項:我沒法用css("background-color", "none")執行此操做,由於它將從css文件中刪除默認樣式。 I just want to remove the background-color inline style added by jQuery. 我只想刪除jQuery添加的background-color內聯樣式。 this


解決方案:

參考一: https://stackoom.com/question/GwAb/如何刪除添加了-css-函數的樣式
參考二: https://oldbug.net/q/GwAb/How-can-I-remove-a-style-added-with-css-function
相關文章
相關標籤/搜索