I am trying to add a class to a html element so that when the user selects a certain type from the drop down list on the UI, the border of the 'type' box changes color. I'd thought I had coded it correctly but I can't seem to get it working.
Here's the css:
.blue {
border: px solid blue !important;
}
Here's the html:
<select class="input_type" name="input_type" style="height:36px" placeholder="Type" required>
<option value="Type">Type</option>
<option value="health">Health</option>
<option value="work">Work</option>
<option value="leisure">Leisure</option>
</select>
Here's the Javascript:
changedType: function(type) {
if (type === "health") {
var blueBox = document.querySelector('.inputType');
blueBox.addClass('blue');
}
},
Here's where the method is called:
document.querySelector(DOM.inputType).addEventListener('change', UICtrl.changedType(usersInput.type));
Any ideas? Thanks for your help in advance!