Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #20683
| From | "Mel Smith" <med_cutout_syntel@aol.com> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: tabIndex to Input Object ?? |
| Date | 2013-07-16 18:36 -0600 |
| Message-ID | <b4m79bFe157U1@mid.individual.net> (permalink) |
| References | <b4lmlbFakaoU1@mid.individual.net> <ujk9s07ccty2.18d53e04mzn7z.dlg@40tude.net> |
JJ said:
>> nextobj = convertToObject(mytable,newtabIndex) {/* ???*/ }
>
> AFAIK, DOM doesn't provide a property/function to list all focusable
> elements, so you'll have to manually search it. One example is to use
> "document.querySelector" (using CSS selector). e.g.:
>
> function convertToObject(elementId, tabIndex) {
> //return null if not found
> return document.QuerySelector(
> '#' + elementId + ' input[tabindex="' + tabIndex + '"]'
> );
> }
> var ele = convertToObject("mytable", 123);
> if (ele) {
> console.log(ele.value);
> } else {
> console.log("Element not found");
> }
Hi JJ:
I should have said that each of these text input boxes are part of the
cells of a table, and have no 'id' property (yet). This is because rows can
be added and deleted, and the input elements in each new row would have to
be given unique ids.
But after a row is inserted or deleted, I *do* run a function to reset
the tabIndexes of each of the input text boxes to start at 201 and proceed
upto approx 260.
My mind 'blows up' when I try to think of a way to assign them all
unique IDs so that my editing function will know how to move
Up/Down/TopRow/BottomRow, etc -- with the input of an Up-Arrow,Dn-Arrow,
PageUp, PageDn, etc, etc, Carriage Return, etc.
Thanks for coming to my rescue -- again ! I'll think more on it and try
to use the QuerySelector.
-Mel
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
tabIndex to Input Object ?? "Mel Smith" <med_cutout_syntel@aol.com> - 2013-07-16 13:53 -0600
Re: tabIndex to Input Object ?? JJ <duh@nah.meh> - 2013-07-17 05:06 +0700
Re: tabIndex to Input Object ?? "Mel Smith" <med_cutout_syntel@aol.com> - 2013-07-16 18:36 -0600
Re: tabIndex to Input Object ?? JJ <duh@nah.meh> - 2013-07-17 10:44 +0700
My (so-called) solution "Mel Smith" <med_cutout_syntel@aol.com> - 2013-07-18 09:50 -0600
csiph-web