How do I switch my CSS stylesheet using jQuery?

$('#grayscale').click(function (){
   $('link[href="https://stackoverflow.com/questions/7846980/style1.css"]').attr('href','style2.css');
});
$('#original').click(function (){
   $('link[href="style2.css"]').attr('href',"https://stackoverflow.com/questions/7846980/style1.css");
});

Give this a try but not sure if it will work I have not tested it but gd luck.

Leave a Comment