Focusing on the textbox and setting the cursor at the end of the prepopulated text
Here's a simple way to focus the textbox and set the cursor at the end of prepopulated text box:
This code will find the first input visible element in first form in DOM and set the cursor at the end of the text box. This stores the value of the textbox in temp string, resets it and reloads the text.
jQuery(document).ready(function(){
var el= jQuery('form:first :input:visible:enabled:first');
el.focus();
tmpStr= el.val();
el.val('');
el.val(tmpStr);
}};
Here's a simple way to focus the textbox and set the cursor at the end of prepopulated text box:
This code will find the first input visible element in first form in DOM and set the cursor at the end of the text box. This stores the value of the textbox in temp string, resets it and reloads the text.
jQuery(document).ready(function(){
var el= jQuery('form:first :input:visible:enabled:first');
el.focus();
tmpStr= el.val();
el.val('');
el.val(tmpStr);
}};
No comments:
Post a Comment