How can I go about in clearing these textboxes by looping through them using Jquery?
<div class="col-md-4" id="RegexInsert">
<h4>New Regex Pattern</h4>
<form role="form">
<div class="form-group">
<label for="firstName">Desription</label>
<input type="text" class="form-control" id="txtRegexDesription" placeholder="Description" />
</div>
<div class="form-group">
<label for="firstName">Regex pattern</label>
<input type="text" class="form-control" id="txtRegexPattern" placeholder="Regex pattern(C#)" />
</div>
<div class="form-group">
<label for="firstName">Data type</label>
<input type="text" class="form-control" id="txtDataType" placeholder="Data type" />
</div>
<button type="button" class="btn btn-default btn-sm btnAddRegexPattern" data-applicationid=""><span class="glyphicon glyphicon-plus"></span> Add</button>
</form>
</div>
I am doing the following which is not quite there yet.
$("#RegexInsert .inputs").each(function () {
$('input').val('');
});
kind regards
You don't need a loop, you can do it in a single selector:
$('.form-control').val('');
I'm not sure where .inputs
in your example is coming from as it is not in your HTML. You can make the selector more generic if required:
$('#RegexInsert input[type="text"]').val('');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With