So I have a list of filters when on clicked on it it should add a class to the img, so when clicked on the filter brannan it should add class='brannan' to the img, the option and value are identical to the class one. How can I know addClass(); to the image, for example, if I select the filter brannan it should add the class brannan to the img.
<div class="form__field">
<img id="preview" src="#" alt="Image preview" />
</div>
<div class="form__field">
<select name="filter">
<option value="_1977">1977</option>
<option value="aden">aden</option>
<option value="brannan">brannan</option>
<option value="brooklyn">brooklyn</option>
<option value="clarendon">clarendon</option>
</select>
I'm assuming the code will follow something like onchange on the select -> get value of it -> addClass();