문제

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; 
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top