I am doing a small jQuery function. What this function should do is on leaving textbox it should display text from textbox as alert, clears textbox and again set focus in the same textbox. It is doing two of three tasks showing text in alert and clearing textbox but it is not setting focus back in that textbox.
Please note this textbox is in a form and I have used tab index here as well. When I clicked ok in alert it move focus to the next textbox having next tab index.
Here is my code:
<script type="text/javascript">
function pageLoad() {
$("input[id$='txtEmailAddress']").blur(CheckOnServer);
}
function CheckOnServer() {
alert($("input[id$='txtEmailAddress']").val());
$("input[id$='txtEmailAddress']").val("");
$("input[id$='txtEmailAddress']").focus();
alert("2");
}
</script>