How do you add a key down event with this text box?
@Html.TextBox("txtbx1", "", new {...} )
You could do something like the following:
@Html.TextBox("txtbx1", "", new { onkeydown="MyFunction();" } )
Try it like this.
Call:
@Html.TextBoxFor(model => model.BoardSizeX, new { @onkeydown = "return Foo(event, $(this).val());"})
Function:
function foo(event, currentValue) {
console.log(event);
console.log(currentValue);
return true;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With