Skip to content Skip to sidebar Skip to footer

Onclick Button Input Not Working In Chrome

Javascript code: function doClick() { alert('clicked'); } HTML code:
Copy

and then the javascript:

function doClick()
{
alert("I've been clicked");
}

And that works for me :)


Solution 2:

the submit button already has a default functionality . it wont trigger the onclick function in many browsers. try changing the button type to 'button' and try to submit the form using javascript.


Solution 3:

For your sample. It should work.

There are two things you should be sure:

  1. When you click the button, make sure that the Javascript code has been loaded.
  2. Your Javascript code must not have any syntax error.
  3. If the button is inside a form, after clicked, the form could be submitted.

Post a Comment for "Onclick Button Input Not Working In Chrome"