I am trying to use onsubmit
to call a function in javascript but it is not working. I have tried looking similar questions but nothing worked. I have also tried onclick
with the submit button, that too doesn't seem to work.
<form method="POST" onsubmit="return add();" name='contact'>
I want this to work with pure JS, not jquery.
Here is the fiddle.
By default fiddler adds the script in a onload handler as given below, so all the functions/variables created in the script will be inside the scope of the onload handler. When you use the inline event handler the script will look for the method in the global scope where the method won't be found
so in the left panel under Frameworks & Extensions in second select box select
No Wrap - In body
orNo Wrap - In Head