HOW TO REMOVE THE EVENT LISTENER?

Amit Singh

Total Post:565

Points:2825
Posted by  Amit Singh
 1547  View(s)
Ratings:
Rate this:
  1. Amit Singh

    Post:565

    Points:2825
    How to remove the Event Listener?

    <script type="text/javascript">
    document.getElementById("hitme4").removeEventListener("click", hitme4, false);
    </script>

    Key Events

    "onkeydown", "onkeypress", "onkeyup" events are supported both in ie and standards-based browsers.

    <script type="text/javascript">
    function setStatus(name,evt) {
    evt = (evt) ? evt : ((event) ? event : null); /* ie or standard? */
    var charCode = evt.charCode;
    var status = document.getElementById("keyteststatus");
    var text = name +": "+evt.keyCode;
    status.innerHTML = text;
    status.textContent = text;
    }
    </script>
    <form action="">
    <input type="text" name="keytest" size="1" value=""
    onkeyup="setStatus('keyup',event)"
    onkeydown="setStatus('keydown',event)"
    />
    <p id="keyteststatus">status</p>
    </form>

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!