I have a page with the following select box on it:
<form>
<select id="themelist">
<option value="style.less">Style 1</option>
<option value="style-2.less">Style 2</option>
</select>
</form>
and this in the head:
<link rel="stylesheet/less" type="text/css" href="style.less" id="lesslink">
<script src="https://cdnjs.cloudflare.com/ajax/libs/less.js/3.7.1/less.min.js"></script>
I also have the following in my script.js
:
$("#themelist").change(function() {
var newTheme = $("#themelist option:selected").val()
$("#lesslink").attr({href : newTheme});
});
When I choose Style 2 from the dropdown, I get no errors, but it doesn't switch the style of the page. I know I'm getting into the function, and that newTheme
is the right value, via alerts.
What am I missing here?
Thanks,
EDIT: After further review, it seems that going from style to style-2 enacts a few small CSS changes that are consistent, but random, and going from style-2 to style does nothing. Which now totally confuses me. This is also with using less.refresh(). Also, no errors are thrown in the console.