28-09-2011

jQuery Switch css stylesheet with jQuery

Yhe following snippet shows one way you can quickly switch the source for your screen stylesheet with jQuery:

$('link[media='screen']').attr('href', 'Alternative.css');

This assumes you have your style sheet link markup along these lines:

<link rel="stylesheet" media="screen" type="text/css" href="mystyle.css" />

Comments:

Your comment:

»

 

[x]