What's difference between jQuery keypress and JavaScript onkeypress?
When I'm trying to get cursor's start/end position in textbox/textarea in jquery I must use this one (using caret plugin)
$("#sometextbox").keypress(function(e){
var stratposition = this.caret().start;
var endposition= this.caret().end;
});
but when onkeypress
<textarea onkeypress="return makeGeo(this,event);"></textarea>
function makeGeo(ob,e) {
var startPos = ob.selectionStart;
var endPos = ob.selectionEnd;
}
Is there any way to get cursor's positions in jquery without caret plugin?