UKPixie
UKPixie

Reputation: 149

Changing CSS stylesheet on button click

I folks, I've had a good look through but nothing seems similar to mine.

I've just finished creating a custom CMS and now want to implement customization capabilities, like templates.

I believe it uses Javascript but, I have a variety of of stylesheets on a server. css.css, css1.css etc with css.css being the main.

Is it possible that on a button click, I could choose a different sheet meaning that in essence, the sheet I would choose became the main style sheet, css.css?

Thanks for any help you can offer.

Upvotes: 1

Views: 996

Answers (1)

GolezTrol
GolezTrol

Reputation: 116100

Yes, you can insert a link element in the head of your page. You can do this using document.createElement, or using JQuery if you use that. If you actually want to toggle the style sheets, you can remove the previous link element, or just replace its href attribute.

Upvotes: 2

Related Questions