I have several input fields that I need to filter the input on. I've put them in a class and used a regular expression to limit the characters to numbers, letters, and underscore. That works fine, but when I tab from one input field to the next, the cursor moves to the end of the input text. I want it to be highlighted so that it can be typed over if desired instead of having to highlighting it with the mouse first.
<input type="input" class="jqfc" value="one"><br>
<input type="input" class="jqfc" value="two"><br>
<input type="input" class="jqfc" value="three"><br>
<input type="input" value="highlights"><br>
jQuery('.jqfc').keyup(function () {
this.value = this.value.replace(/[^a-z0-9\_]/gi, "");
});
sample: http://jsfiddle.net/ngwr6/2/