I have multiple input fields where the user can select a date time, the only difference between these fields is the data-department attribute.
<div class="col-sm-10">
<input type="datetime-local" class="StartTime" data-department="2" name="bdaytime">
</div>
<div class="col-sm-10">
<input type="datetime-local" class="StartTime" data-department="3" name="bdaytime">
</div>
I want to be able to clear the value in an input field based on the data-department attribute.
How can I clear the value of an input field based on the class and data-department?
So for example if I want to be able to clear just a single input field where class equals StartTime and data-department equals 2?
I tried using the below code however it didn't work.
$('input:datetime-local').find('data-department' = 2).val('');