jQuery, altering css class itself -


Is it possible to change the CSS class with jQuery? For example, if I have a definition of this class:

  .my-class {right: 10px; }  

and now I will call it

  .my-class {right: 20px; }  

with $ (". MyClass") without selecting all the elements of this class. The reason for this is that I am adding a lot of elements in running time in JS and it is good to swap the class definition before time.

.MyClass is defined in the CSS file, otherwise it was on the page with JSF / JSTL that I could change my definition.

Technically, you can edit stylesheets using JavaScript with the document.styleSheets object, But you find it much more work than worth it. Read this article to find out what it is wrong:


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -