I have a textbox, where a forbidden character cant be typed. #.
This works, however, when the textbox is filled in with data, and I put the focus on the middle of the textbox and then I use the arrow keys to go left and right, then it jumps to the end of the textbox.
If I type a character also in the middle of the textbox, it goes to the end again
$('[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
});