javascriptdom-eventsunobtrusive-javascript

How can we perform reset function in master page of aspx page?


function reset1()
            {
                alert("123");
                document.form1.reset();
                return false();
            }

I want to have resetting controls of a master page using Javascript, but it doesn't work properly. Can anyone help me to get through to it working?

Above is the function of reset which I used for resetting.


Solution

  • Javascript is case-sensitive. Is it possible that you have your form name wrong? Try to use an index instead...

    document.forms[0].reset();
    

    Or perhaps you are not sure what reset is supposed to do. It restores each element on the form to its default value. It should do exactly what a <input type="reset"/> would do.