How to use key down event with Html text box helper in MVC4

Ell picture Ell · Jul 23, 2013 · Viewed 9.6k times · Source

How do you add a key down event with this text box?

@Html.TextBox("txtbx1", "", new {...} )

Answer

Jack picture Jack · Jul 23, 2013

You could do something like the following:

@Html.TextBox("txtbx1", "", new { onkeydown="MyFunction();" } )