Ajax Calls, .val() and Deselecting Highlighted Values
I have numerous input fields and when a user changes a value on any input field then hits the tab key, it moves to the next field (default browser behavior) and completely highlights the text in that field. This works as expected.
On the blur event for the changed field, I send an ajax call to the server which sends back some values which updates every text field.
e.g. When the user hits tab, the blur event is called, and the cursor goes to the next field and highlights all of the characters in that field, as expected. But after the ajax call returns and I perform a .val(newValue) on all of the inputs on the page. After that happens, it un-does the highlighting of the field that was tabbed to, and the cursor goes to the end of that field. I would like the tabbed to field to stay completely highlighted after the ajax call returns and sets the values of all of the fields. Is there something built in that handles this, or do I need to roll my own highlighting function that re-highlights the field after the ajax call returns and calls .val on all of the fields. Thanks in advance.