Click here to Skip to main content
15,914,820 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

i want to change an attribute (ex: width...) of a class that is created in a css file) and then use it as in its new values.

my problem is that i'm using a component written in js file and it is using a css file, i have to use this component 2 times and in different values of class.

kindly help me,
Thanks
Posted
Comments
ZurdoDev 21-Mar-12 10:03am    
you can change width by doing $("#idOfElement).width(newWidth); but your question is not very clear so I am not sure if that is what you are wanting.
Rojeh 21-Mar-12 12:52pm    
it's not the point,
i want to use the same class in two methods but with different values.
so i want to change the values of the class before using it.
10x anw.

You can't change the css file after it has been downloaded. You can override the css that is applied to an element using the css[^] function from JQuery
 
Share this answer
 
Comments
Rojeh 21-Mar-12 12:52pm    
ok 10x anw
You can use jQuery "class" and .css methods:
http://api.jquery.com/category/css/[^].

—SA
 
Share this answer
 
Hi,
Using Jquery you can add or remove css of any html control.
Use addClass/removeClass method to add/remove css of html controls.
Jquery add remove css.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900