I want to change the used CSS File (<link href="..." />) dynamically using only javascript and to save changes in cookies.
This is a jQuery version that does what I want (ref), but how can I do this in javascript?
if($.cookie("css")) {
$("link").attr("href",$.cookie("css"));
}
$(document).ready(function() {
$("#nav li a").click(function() {
$("link").attr("href",$(this).attr('rel'));
$.cookie("css",$(this).attr('rel'), {expires: 365, path: '/'});
return false;
});
});
Thank you in advance.
maybe this could help you..
Edit, full JavaScript without jQuery