문제

I have Address field in my web form.. I want to limit the characters in that textbox.. I don't know how to do this by mvc2..

My html code

<%: Html.TextBox("Address",Model.Address, new {@title="Enter your address"}) %>

If any chances in jquery is there means it will ok..

도움이 되었습니까?

해결책

Here it is maxlength="x" where x: length

<%: Html.TextBox("Address",Model.Address, new {@title="Enter your address", @maxlength="10"}) %>

Or using jQuery,

$('#Address').attr('maxlength', '10');
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top