Hi, > I am able to get the element lotTotalTr = $(accountTotal) to work
IDs cannot contain spaces[1]. Apparently you're getting away with it on the $() call (the underlying getElementById must be allowing it), spaces have meaning in selectors. Invalid IDs will not work reliably. [1] http://www.w3.org/TR/html401/types.html#type-name HTH, -- T.J. Crowder tj / crowder software / com Independent Software Engineer, consulting services available On Aug 7, 8:18 pm, molo <[email protected]> wrote: > I have the following httml and javascript code (see snippets below). > I am running this using firebug > > I am able to get the element lotTotalTr = $(accountTotal) to work > However the select on the element does not work. I have tried many > variations of the select > totalLotSharesTd = lotTotalTr.select('td.totalLotShares') > > I was able to use lotTotalTr.childElements() and then > totalLotSharesTd3 = totalLotSharesTd2[3] to position myself where I > want to be but not select. This is not a good way to do this > > Can anyone explain this to me? > > -------------------------------------------------- > <tr id="Total 87002B" class="TableRow1"> > <td type="text">Total 87002B</td> > <td type="text"/> > <td type="text"/> > <td class="totalLotShares" name="totalLotShares" type="text">18031</ > td> > <td type="text">316186.29</td> > <td type="text">316186.29</td> > <td type="text"/> > <td type="text"/> > </tr> > > ----------------------------------------------------- > > function lotShareChange(obj){ > var e = $(obj).up('tr'); > var account = e.select('td input.account'); > var accountVal = account[0].value; > var accountTotal = "Total " + accountVal; > var lotTotalTr = $(accountTotal); > > var totalLotSharesTd; > var totalLotSharesTd2, totalLotSharesTd3, totalLotSharesTd4; > > totalLotSharesTd = lotTotalTr.select('td.totalLotShares'); // > selects do not work > totalLotSharesTd2 = lotTotalTr.childElements(); //worked > totalLotSharesTd3 = totalLotSharesTd2[3]; //worked > totalLotSharesTd4 = lotTotalTr.select('td'); //does not work > //totalLotSharesTd = lotTotalTr.select('td'); > > totalLotSharesTd3.update(totalShares); > > } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---
