Hi,
I have a quite general question.

I have the following markup:
<table id="articles">
        <tr class="product">
                <td>
                <select size="1" name="prod1" id="prod1"
class="amount">
                        <option>0</option>
                        <option>1</option>
                        <option>2</option>
                </select>
                </td>
                <td>Produkt 1</td>
                <td class="price">5</td>
                <td class="total">0</td>
        </tr>
</table>

And now I'd like to calculate from the selected ("amount" * "price")
and write this into "total".

At the moment I catch the "change" like this:
$(".amount").change(function() {
        alert($(this).val());
});

But how do I access "price" and "total"? Sure, I could search once
again, but as I want to display more products, I would prefer to go up
the hierarchy and descend once again. I already tried it once with
parent() but I'm not sure how this would work when changing the
markup.
Perhaps I could find a successor with a specific "id" with
parent("specificID") but how can I descend once again in the DOM to
access the before mentioned elements?

I hope my description is comprehensible enough.

Thanks for any suggestions,

Christoph

Reply via email to