Theos Artise
Theos Artise

Reputation: 19

add a css property

I'd like to add into a css property like this

[css]

.someclass some
{ 
///
}

[jquery]

$('.someclass some').css('behavior','url(path/something/someclass.htc)');

This return an error message as "TypeError:Object Expected"

Upvotes: 1

Views: 631

Answers (2)

Scott Selby
Scott Selby

Reputation: 9570

try this:

 $('.someclass some').css({'behavior' : 'path/something/someclass.htc' });

just copying your code for behavior property - you know it should look like this....

 $('.someclass some').css({'behavior' : 'url (path/something/someclass.htc)' });

This code will add the css property to the selector in your DOM , if you want to actually change the css file - you can not do that , but you can do this

 $('.yourClass').addClass('behavior');

the class .behavior you put in your css - this will have extra properties , and you dynamically add this class to the elements that you want to have it

Upvotes: 0

landons
landons

Reputation: 9547

Add a class to your CSS file, then toggle it in your JavaScript.

Upvotes: 1

Related Questions