2 回答

TA貢獻1866條經驗 獲得超5個贊
使用maxlength屬性:
@Html.TextBox("textBoxFillToAnothertextBox", null, new { id = "textBoxFillToAnothertextBox",maxlength = 250 , @class = "form-control", placeholder = "Fill in to apply for textBoxAddress" })
或者
$('#textBoxFillToAnothertextBox').on('keyup change', function() {
if ($('#textBoxFillToAnothertextBox').val().length > 250) {
$('#ADDRESS').text('error message');
} else {
$('#textBoxAddress').val($('#textBoxFillToAnothertextBox').val());
}
});

TA貢獻1719條經驗 獲得超6個贊
目前我使用@StephenMuecke 的概念。
jQuery:
$('#textBoxFillToAnothertextBox').on('keyup change', function () {
$('#textBoxAddress').val($('#textBoxFillToAnothertextBox').val());
$('#textBoxAddress').focus();
$('#textBoxFillToAnothertextBox').focus();
});
- 2 回答
- 0 關注
- 226 瀏覽
添加回答
舉報