friendica-addons-sekb/jappixmini/jappix/js/jquery.textrange.js
2012-04-18 01:12:24 +02:00

14 lines
456 B
JavaScript

$.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();
}
});
};