Cybercrux

Everything is achievable through technology

focuz to end

fiddler


editables = function (Tabs) {
$(Tabs).prev().attr('contenteditable', 'true').focusEnd();;
// placeCaretAtEnd($(Tabs).prev())
}
noteditable = function (Tabs) {
$(Tabs).attr('contenteditable', 'false');
}
$.fn.focusEnd = function() {
$(this).focus();
var tmp = $('').appendTo($(this)),
node = tmp.get(0),
range = null,
sel = null;

if (document.selection) {
range = document.body.createTextRange();
range.moveToElementText(node);
range.select();
} else if (window.getSelection) {
range = document.createRange();
range.selectNode(node);
sel = window.getSelection();
sel.removeAllRanges();
sel.addRange(range);
}
tmp.remove();
return this;
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s