My HTML contains a fieldset, six text input fields formatted in a table, and a submit button. The submit button includes the attribute onClick="check()" and it’s worked with simpler alerts so I know that’s not the problem. Here’s my JavaScript:
var $ = function (id) { return document.getElementById(id); }
function check() {
var x = $("myForm");
var y;
for (var i=1; i < x.length; i++) {
y += (x.elements[i].value + "<br />;");}
alert("values: <br />" + y)
}
When I click the submit button, I don’t get any alert at all. What should I do?
This is probably not the answer you’re looking for.
If you’re on Firefox, install the Firebug addon, open it up and see what errors you are getting.
If you’re on Chrome, open up the Javascript console (Ctrl+Shift+J), and see what error your are getting.
Otherwise: choose your weapon 🙂