function getCaret(el) {
                        if (el.selectionStart) {
                            return el.selectionStart;
                        } else if (document.selection) {
                            el.focus();

                            var r = document.selection.createRange();
                            if (r === null) {
                                return 0;
                            }

                            var re = el.createTextRange(),
                                rc = re.duplicate();
                            re.moveToBookmark(r.getBookmark());
                            rc.setEndPoint('EndToStart', re);

                            return rc.text.length;
                        }
                        return 0;
                    }
function taken from http://stackoverflow.com/a/263796/772859
@param el
@returns {*}