Answers ( 2 )

    6
    January 12, 2017 at 3:30 am

    Please briefly explain why you feel this answer should be reported .

    Report Cancel

    Consider this code:

    <input type="button" value="Test Fire!" onclick="debugger;" />
    Best answer
  1. Anonymous
    2
    January 12, 2017 at 3:30 am

    Please briefly explain why you feel this answer should be reported .

    Report Cancel

    There is no reason to complicate (I really do not know why it does not work), but you can use:

    • Add the alert directly in the input.

    Result: https://jsfiddle.net/cmedina/h4m1qcoq/6/

    or

    Add listener to input

    function lang() {
       alert("Hello, World! It's JavaScript this time");
    }
    
    document.getElementById('test').onclick = lang
    

    Result: https://jsfiddle.net/cmedina/h4m1qcoq/7/

Leave an answer

Browse

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>