How to delete all kind of input field inside a form when clicking a href element?
<script type="text/javascript">
$('.delete-link').on('click', function() {
//remove all input inside #form-delete
});
</script>
<form id="form-delete" action="/post>" method="post">
<input type="text" name="test1" value="">
<textarea name="test2" rows="8" cols="80">TEST</textarea>
<input type="checkbox" name="test3" value="">
<input type="number" name="test4" value="">
<input type="password" name="test5" value="">
<input type="email" name="test5" value="">
</form>
<a href="#" class="delete-link">
<span>Remove All input</span>
</a>
$("#form-delete").find("input").remove();$("#form-delete").find(":input").remove();<input>elements. If you want to delete<textarea>too, then you could do$("#form-delete").find("input,textarea").remove();$("#form-delete").find("input,select,textarea").remove();