diff options
author | Julio Capote <jcapote@gmail.com> | 2018-11-06 03:03:41 +0000 |
---|---|---|
committer | Julio Capote <jcapote@gmail.com> | 2018-11-06 03:03:41 +0000 |
commit | 4b489a049a0063bbb1fd9f0c0f74ce1ee9f87a86 (patch) | |
tree | 98af5707e30150af482e297bed9cd4e9b5477e6a /content/post/2008-10-11-tabbing-through-fields-vertically.markdown | |
parent | a62a3e7755579d93ce3a87243dd277575930fffe (diff) | |
download | capotej.com-4b489a049a0063bbb1fd9f0c0f74ce1ee9f87a86.tar.gz |
import old posts
Diffstat (limited to 'content/post/2008-10-11-tabbing-through-fields-vertically.markdown')
-rw-r--r-- | content/post/2008-10-11-tabbing-through-fields-vertically.markdown | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/content/post/2008-10-11-tabbing-through-fields-vertically.markdown b/content/post/2008-10-11-tabbing-through-fields-vertically.markdown new file mode 100644 index 0000000..639cbb3 --- /dev/null +++ b/content/post/2008-10-11-tabbing-through-fields-vertically.markdown @@ -0,0 +1,26 @@ +--- +layout: post +title: "Tabbing through fields vertically" +date: 2008-10-11T01:54:00Z +comments: false +permalink: /post/54058512/tabbing-through-fields-vertically +categories: +--- + + + +Sometimes it’s useful to switch the browser’s default tabbing behavior (left to right) to the opposite (top to bottom) when your input fields are in a grid layout instead the of the usual single column layout. Having to do this manually is a real pain, especially for large grids; So here is a solution in javascript, using mootools: + +```javascript +window.addEvent('domready', function(){ + var trs = $$('#mytable tr') + var accum = 0 + trs.each(function(tr, trindex){ + accum = trindex + 1 + tr.getChildren().each(function(td, tdindex){ + td.getChildren('input')[0].tabIndex = accum + accum = accum + trs.length + }) + }) +}) +``` |