jquery – Adding a class to a div based on an input’s value
Question
I am trying to add a class to a specific div, if a specific input field has a specific value. Below is my code, but it does not seem to be working. This is a dropdown select if this helps. This is built in WordPress, but the code does nothing. Please help!
Thanks in advance!
This is my input.
<input type="hidden" name="field-name-1676017181767" value="online_event">
This is my code.
$('input').change(function() {
if($(this).val() === 'online_event') {
$('.vue-treeselect__control').addClass("hidden");
}
else {
}
});
0
1 month
2023-02-10T03:29:58-05:00
2023-02-10T03:29:58-05:00 0 Answers
0 views
0
Leave an answer