Is it possible to change attribute properties in a style.css file using a jquery onclick event from html file?
I am using the below currently, but I would like to change the css file itself.
$('#demo').click(function(){
$(.#demo').slideUp();
this.style.backgroundColor = 'red';
});
You cannot edit the file itself. However, you can override styles a number of ways.
styleelement with the required rules and append to the document. (Example).cssto change the desired properties. (Example).addClassand.removeClass. (Example)For the type of behavior you describe, you’d use #2 or #3 (#3 is recommended because it’s the easiest to maintain). Here’s #2 in practice using your example: http://jsfiddle.net/HackedByChinese/HTNGs/1/