jquery - removing css style for element by ID -


How to disable the style for the element is already styled with CSS in the name of the element and I Can not make the same style. Is the name of a square in the CSS just a # element name, which is not shown on the HTML code?

You can try:

  $ (selector "). RemoveAttr ("style");  

But my question is: Why do you want to remove CSS styles? Usually this is an indication that you are not doing something well. As will write something:

  $ ("selector") Hover (function () {$ (this) .Css ("background", "red");}, function () {// ???});  

The problem is that you do not know what to do to set the background to reset it to normal. This is the reason why you should use the classes:

  div.highlight {background: red; }  

with:

  $ ("selector"). Hover (function {$ (this) .addClass ("highlight");}, function () {$ (this) .removeClass ("Highlight");});  

The problem is resolved.

That is why I can not comment on your view because you have not provided enough detail but my experience questions such as "How do I remove a style?" Is a red flag.


Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -