I want to clear all input and textarea fields in a form. It works like the following when using an input button with the reset class:
reset
$(\".reset
Tested and verified code:
$( document ).ready(function() { $('#messageForm').submit(function(e){ e.preventDefault(); }); $('#send').click(function(e){ $("#messageForm")[0].reset(); }); });
Javascript must be included in $(document).ready and it must be with your logic.
$(document).ready