html - Edit external stylesheet with jquery -
i trying create web design template , edit stylesheet based on radio button selection using query.
please see attached fiddle http://jsfiddle.net/2mkjv/1/
what i'm trying achieve is, if select blue, find external stylesheet , class .container , change background blue. if manually edit stylesheet after, changes saved, possible?
it's basic html:
<div class="container"> <input type="radio" name="colours" value="female" checked> red <input type="radio" name="colours" value="female">blue </div>
& css
* { padding:0; margin:0; } html, body { width:100%; height:100%; } .container { width:100%; height:100%; background:red; }
simple answer: can't jquery alone.
longer answer: jquery extension of javascript, nature, run on client side in browser. thus, can't directly change files stored on server. can, however, use jquery's ajax feature access server-side script change file, such php.
in php, example, use file_put_contents() write file achieve this.
Comments
Post a Comment