I have two fields which appear as the data is already entered before:
On certain condition an if condition is called and these value needs to be cleared. I tried to pass blank string inside val() so that it becomes empty
but it is not working, data is still displayed:
<div class="col-md-12 fromDates" style="margin-bottom: 10px; display: block;">
<label for="fromDate">From Date</label>
<input type="text" id="assessFrom" required="" name="assessFrom">
</div>
<div class="col-md-12 toDates" style="margin-bottom: 10px; display: block;">
<label for="fromDate">To Date</label>
<input type="text" id="assessTo" required="" name="assessTo">
</div>
if (assessmentType == "firm" || assessmentType == "product") {
$('.fromDates').val('');
$('.toDates').val('');
}

$('.fromDates input')instead of$('.fromDates').