html - JavaScript function doesn't run on click -


although know lot these languages such arrays , functions, i'm having basic problem getting javascript run, here's code:


<!doctype html>  <html>    <head>  </head>    <body>    <input type="submit" value="submit" onclick="click()" />    <script>      function click() {        alert("hey");      }    </script>  </body>    </html>

you're running problem: javascript function name cannot set click?

you can fix changing function name else function myclick

<head> </head>  <body>   <input type="submit" value="submit" onclick="myclick()" />   <script>     function myclick() {       alert("hey");     }   </script> </body>  </html> 

Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -