Focus and Select a Form Input

/** @id codeFocus
* @classDescription Focuses on the selected input and selects the value text.
*/
var postcodeFocus = {
grab:function(){
if(!document.getElementById){return;};
if(!document.getElementById('selected')){return;};
var theInput = document.getElementById('selected');
theInput.focus();
theInput.select();
}
}

source

Leave a Reply