Skip to content

Instantly share code, notes, and snippets.

@cipheos
cipheos / jQuery.selectRange.js
Last active March 1, 2017 10:20 — forked from beiyuu/select-text-range.js
jQuery:Select a text range (input/textarea)
$.fn.selectRange = function(start, end) {
this.each(function() {
var el = this[0];
if (el) {
el.focus();
if (el.setSelectionRange) {
el.setSelectionRange(start, end);