I am writing a sortby function that uses two "select"s on the page and digs out the option val and submits the page for a new view. You can see the sortby on this page:
http://www.beachhouse.com/vacation/search.asp?Country=United+States&State=California&City=Newport+Beach at the top and bottom. I figured I could set a class for both the selects as class="sortby", and do singel $(.sortby).change(function() BUT that did not seem to work so I created two unique ids for the selects, id="sortBy1" and id="sortBy2". Which works. Just wondering if I could optimize and collape these: <jcode> $('#sortBy1').change(function(){ var str = ""; str = "&order=" + $("#sortBy1 option:selected").val(); window.location = "http://www.beachhouse.com/vacation/search6.asp? s=1" + str; }); $('#sortBy2').change(function(){ var str = ""; str = "&order=" + $("#sortBy2 option:selected").val(); window.location = "http://www.beachhouse.com/vacation/search6.asp? s=1" + str; }); <htmlcode> <select class=""sortby"" id=""sortBy1""> ... </select> <select class=""sortby"" id=""sortBy2""> ... </select>