thanks morningz - that's a lot neater than my solution: $(document).ready(function(){ $("#sweets").change(function (){ var str = ""; $("select option:selected").each(function (){ str += $(this).text() + " "; }); $("#basket").val(str); }) $("#crisps").change(function (){ var str = ""; $("select option:selected").each(function (){ str += $(this).text() + " "; }); $("#basket").val(str); }) .change(); });
[based on the events/change demo @ jquery.com - http://docs.jquery.com/Events/change] On Mar 5, 9:21 pm, MorningZ <morni...@gmail.com> wrote: > Assuming you have something like > > <select id="select1"> > <option value="1">1</option> > <option value="2">2</option> > <option value="3">3</option> > </select> > > <select id="select2"> > <option value="1">1</option> > <option value="2">2</option> > <option value="3">3</option> > </select> > > <input type="text" id="total" readonly="readonly" /> > > Then the jQuery could be: > > $("#select1, #select2").change(function() { > $("#total").val( Number($("#select1").val()) * Number($ > ("#select2").val()) + 1 ); > > }); > > On Mar 5, 4:05 pm, "black.horizons" <black.horiz...@gmail.com> wrote: > > > hi guys, > > > just wondering how i would update the value of an input box to be the > > value of the sum of two select (drop down boxes) plus 1. > > > i.e. > > > (select1.value * select2.value) + 1 > > > I need to do this everytime either of the two fields are updated. > > > my pseudocode is: > > > select1.onUpdate{ > > total.value = (select1.value * select2.value) + 1;} > > > select2.onUpdate{ > > total.value = (select1.value * select2.value) + 1; > > > } > > > if anyone can help me "translate" this to jquery i'd be mighty > > relieved. > > > thanks, > > > alex