I am having trouble with my javascript. It seems to be acting oddly. This is what\'s going on. I have a form, after the user submits it, it calls a function(onsubmit event)
I've had the same problem. Once I remove the alert("") it doesn't work. I figured it out and that's the deal.
In HTML, when you use to place your button, the browser acts differently; when you click on it, after calling the event handler, it reloads the page and this is why you should place an alert("") just after your code to prevent the page from reloading.
You can simply use instead of to prevent the browser from reloading the page.