I'm not sure I understand what you're trying to do with the change() function... You know you can get the value of a select just with val(). You don't have to loop through each option to find which is selected.
<select id="mySelect"> <option value="1">1</option> <option value="2">2</option> </select> var myVal = $("#mySelect").val(); // 1 or 2 On Aug 12, 1:18 pm, Nic Hubbard <nnhubb...@gmail.com> wrote: > I am confused about how to do this the right way. > > I have a change event which grabs the value of the selected option > list and sets that as a var. But, I would like to add that to the end > of my post string when I submit the form, how would I do this? > > $('select').change(function() { > > $('select option:selected').each(function() { > > var my_val = $(this).val(); > > });//end each > > });//end change > > $('#my_submit').submit(function() { > > var action = $('form').attr('action'); > // How do I get my_val variable into here?? > $('form').attr('action', action + 'new_parm=' + my_val); > > }); > >