Forum: Ruby on Rails Change stylesheets asynchronously

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
John W. (Guest)
on 2006-06-09 17:30
I have my default "scaffold.css" that loads when the page loads, however
I would like to be able to dynamically change the CSS sheet by clicking
a link.  I tried wrapping the stylesheet like below:

  <div id="css-theme">
    <link rel="stylesheet" href="/stylesheets/scaffold.css"
type="text/css" media="screen" />

and then using link_to_remote to update the "css-theme" div, but that
did work exactly as I was expecting. Can someone give me some ideas as
to how I can do this?  I wouldn't think it would be too hard.
BB (Guest)
on 2006-06-11 08:47
This is a pretty widely used method.

Works great too.
This topic is locked and can not be replied to.