I have read up on it and it seems like the best method to add a stylesheet using jQuery is the following:
$('head').append('<link rel="stylesheet" type="text/css" href="../css/mystyle.css">');
Now what I would like to do, is switch between different themes using this method:
<script type="text/javascript">
$(document).ready(function () {
if($('body').hasClass('pink'))
{
$('head').append('<link rel="stylesheet" type="text/css" href="../css/mystylePink.css">');
}
else
{
$('head').append('<link rel="stylesheet" type="text/css" href="../css/mystyle.css">');
}
});
</script>
MY QUESTION: Apart form users not having javascript enabled, what complications/issues exists when loading a stylesheet like this? IE? Mobile browsers? Since I actually want to use this on a mobile site...