Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • The addEventListener() method in Javascript

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 123
    Comment on it

    an event listener method fires whenever user clicks on a button. It attaches an event handler to the document.
    Example

    <!DOCTYPE html>
    <html>
    <body>
    
    <p>This is the example of addEventListener() method.</p>
    
    <button id="my">Result</button>
    
    <p id="xyz"></p>
    
    <script>
    document.getElementById("my").addEventListener("click", displayDate);
    
    function displayDate() {
        document.getElementById("xyz").innerHTML = Date();
    }
    </script>
    
    </body>
    </html> 
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: