This commit is contained in:
albert
2013-03-10 15:06:11 -04:00
parent 92eb226c4a
commit 458c0b384a
3 changed files with 33 additions and 5 deletions

View File

@@ -73,4 +73,24 @@
});
return filtered;
}
$.fn.selectRange = function(start, end) {
return this.each(function() {
if (this.setSelectionRange) {
this.focus();
this.setSelectionRange(start, end);
} else if (this.createTextRange) {
var range = this.createTextRange();
range.collapse(true);
range.moveEnd('character', end);
range.moveStart('character', start);
range.select();
}
});
};
$.fn.selectEnd = function(){
this.selectRange(this.val().length, this.val().length);
return this;
}
})();