/** * Text Range Selector * * @param {Element} element * @param {Integer} start * @param {Integer} end */functionselect(element,start,end){element=elementinstanceofjQuery?element.get(0):element;end=end===-1?element.value.length:end;element.focus();try{if(element.createTextRange){varrange=element.createTextRange();if(win.navigator.userAgent.toLowerCase().indexOf("msie")>=0){start=element.value.substr(0,start).replace(/\r/g,'').length;end=element.value.substr(0,end).replace(/\r/g,'').length;}range.collapse(true);range.moveStart('character',start);range.moveEnd('character',end-start);range.select();}elseif(element.setSelectionRange){element.setSelectionRange(start,end);}}catch(e){}}