Question: Which option is correct to use the below function to set cursor position for textarea?
Function:$.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();
}
});
};
A
B
C
D
$('#elem').selectRange(3,5);
B
$('#elem').selectRange(3 5);
C
$('#elem').selectRange(X:3,Y:5);
D
$('#elem').fn.selectRange(3,5);
Note: Not available