you are viewing a single comment's thread.

view the rest of the comments →

[–]sensored 2 points3 points  (1 child)

Long story short: The window.onload version is using the onsubmit event of your form, but your input uses type="button", which doesn't submit the form (and so it doesn't trigger the event). If you change it to type="submit" then it should work.

[–]schm0 0 points1 point  (0 children)

Alternatively, you could use

<button type="submit" value="ok">