With
the alert box displays the value in the box, not included the current key dep
It should exhibit the same behaviour. Make sure you load the javascript either in your head or body tags, so you can access the function from the html.
This code works for me: