sathish_at_madison
sathish_at_madison

Reputation: 833

onChange Event not trigerred

AM sure there is something that am missing in this html. The onChange event never gets fired. anyone help?? Thanks

<!DOCTYPE html PUBLIC "-//W3C/DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  <head>
    <title>Wake up call</title>
    <script type="text/javascript">
      function v(elementName) {    // Function is defined here
        alert(elementName);
      }
    </script>
  </head>

  <body bgcolor="lightblue">
    <form>
      <input type="text"
        value="Wake me" id="wake"
        onchange="v(wake)">
    </form>
  </body>
</html>

Upvotes: 0

Views: 101

Answers (1)

kennypu
kennypu

Reputation: 6051

you don't have a variable named wake. either change it to a string:

 <input type="text" value="Wake me" id="wake" onchange="v('wake')">

or if it's meant to be a variable, set the variable somewhere.

Upvotes: 1

Related Questions