Hi Karl, I'm not sure if you missed them, but I placed the input fields inside the table, they are in tr.calc (the second row in the html in my first post). It's just an <input /> tag. That input field would then be a nice starting point, because it's placed directly under the span including the price & in the same cell as the span to be modified.
Greetings, Markus On Sep 9, 2:23 pm, Karl Swedberg <[EMAIL PROTECTED]> wrote: > Hi Markus, > > Can you show us just a bit more of the HTML? It would help a great > deal if we could see where the input field is in relation to the spans > that you want to modify. > > --Karl > > ____________ > Karl Swedbergwww.englishrules.comwww.learningjquery.com > > On Sep 8, 2008, at 4:38 PM, Jayzon wrote: > > > > > > > Hi! > > > I've got a table with multiple rows which I'd like to traverse in a > > special way - here's the html (for better reading, I just included two > > rows, these rows are duplicated with different values): > > > <tbody> > > <tr class="pricing"> > > <td>Example A</td> > > <td><span class="price">1,20</span> €</td> > > <td><span class="price">2,40</span> €</td> > > </tr> > > <tr class="calc"> > > <td>Calculator</td> > > <td><input /><span class="result">0,00</span> €</td> > > <td><input /><span class="result">0,00</span> €</td> > > </tr> > > </tbody> > > > What I'd like to do: If an input filed is focussed, a price should be > > calculated. To keep the script as efficient as possible, I want to > > travel up from the input field to the cell above it (i.e. one row up, > > second or third cell in that row). My problem is: How can I traverse > > the DOM in this way? > > > I imagine the following: The script should "know" where the starting > > point was (second or third cell in row) and then get the corresponding > > cell. I'm sure this is possible, but I have no idea how to achieve it. > > > If I get the DOM traversing right, I want to get the value of > > span.price to calculate the input with it & update the result in - > > yes, span.result ;-) > > > I'm sure this is a pretty easy thing to achieve for people how know > > jQuery well - I unfortunately don't (yet!). Could someone please > > explain this? > > > Thanks for your effort! > > > Markus- Hide quoted text - > > - Show quoted text -