我有一个文本框,不能输入禁止字符。#.
但是,当文本框被数据填充时,这是可行的,我将焦点放在文本框的中间,然后使用箭头键向左和向右移动,然后跳转到文本框的末尾。
如果我也在文本框的中间键入一个字符,它会再次走到最后
$('[id$=txtClient]').keyup(function () {
EnableClientValidateButton(); // When the textbox changes, the user has the ability to validate the client
ChangeColorClient("0"); // The color is changed to white, to notify the user the client is not validated yet.
var $el = $('[id$=txtClient]'); // the text element to seach for forbidden characters.
var text = $el.val(); // The value of the textbox
text = text.split("#").join("");//remove occurances of forbidden characters, in this case #
$el.val(text);//set it back on the element
});