webif/var/mongoose/html/lib/jquery.plugin/tabsupport/tabsupport.js
hummypkg 0f1bbed6b9 migrating
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1789 2a923420-c742-0410-a762-8d5b09965624
2014-02-21 21:25:33 +00:00

24 lines
466 B
JavaScript

(function($)
{
$.fn.tabsupport = function()
{
return this.each(function() {
$(this).keydown(function(e) {
if (e.keyCode == 9)
{
var el = $(this).get(0);
var start = el.selectionStart;
var end = el.selectionEnd;
$(this).val(
$(this).val().substring(0, start) +
"\t" +
$(this).val().substring(end)
);
el.selectionStart = el.selectionEnd = start + 1;
return false;
}
});
});
}
})(jQuery);