According to select option I need to upload pdf or mp3/mp4.
If I select book or question paper, I need the validation to only to upload pdf or doc file,
If I select audio, I should upload mp3 only. If I select video, I should upload mp4 only.
Please help me to do this validation using javascript. I need just condition . the rest will be done through backend
<select id="upload_material" onchange="val()">
<option>Select Material Type</option>
<option value="1">Question Paper</option>
<option value="2">Book</option>
<option value="3">Audio/Video</option>
</select>
<label class="myLabel">
<%= f.file_field :attachment, :onchange => "get_extension($this.value)" %>
<!-- <input type="file" style="margin-left:80px;" name="filetwo"> -->
<span>Browse</span>
</label>