I'm currently working on incorporating the feature for a User to switch themes in my PhoneJS application (possibly also using regular JavaScript).
Here's what I have attempted:
Index.html
<!DOCTYPE html>
<html>
<head>
<link id="style" rel="stylesheet" type="text/css" href="red-stylesheet.css" />
</head>
</html>
Javascript
function swapStyle(sheet) {
document.getElementById('#style').setAttribute('href', sheet);
}
The error I keep encountering is:
Cannot 'setAttribute' for a reference that's undefined or null
This leads me to believe that I am unable to access the link from my index.html file.
My current file structure looks like this:
views (folder)
-> settings (folder)
-> settings.js (javascript)
index.html (html with the <link>)