Kawikak, Naturally I figured it out 15 minutes after posting :)
Option values was the key. I was using old copied code that didn't even specify values, e.g. <option>AK<option>AL<option>AR etc... once I changed that to: <OPTION value=AK>AK</OPTION><OPTION value=AL>AL</OPTION><OPTION value=AR>AR</OPTION> everything is now both hunky and dory. And Matt's way (which I had also tried before) works as well. Final code: $("#zip").keyup(function(){ if ($("#zip").val().length == 5) { $("#state").attr("value","ME"); } }); On to $.post to really process the ZIP code! Thanks, --DIZZLE kawikak wrote: > > I use this function to set the <option> of a drop down input. Works in IE6 > and FF that I know of. You'll notice it only works well for <option>s with > unique values. You could probably easily change it if you needed > otherwise. > > // Usage > $("[EMAIL PROTECTED]'State']").option( "CA" ); > > // "Plugin" > jQuery.fn.option = function (value) { > return this.each(function() { > var select = $(this)[0]; > for ( var i=0; i<select.length; i++ ) > if (select[i].value == value) > select.selectedIndex = i; > }); > }; > > > Kawika > > > > dizzledorf wrote: >> >> Seems like a simple action, and it works in Firefox, but not IE... >> >> I'm trying to change the value of a dropdown box based on an event >> triggered in another text box. It's a contact form, and I just want to >> change the state dropdown Select on the keyup of the 5th character of the >> zip input box. >> >> re: >> $("#zip").keyup(function(){ >> if ($("#zip").val().length == 5) { >> // IE can get in here, but doesn't execute the following line >> $("#state").attr("value","FL"); // just testing for now >> } >> }); >> >> As I mentioned, this works in Firefox 1.5.0.7, but not in IE6... >> >> How do I get this going in IE? >> >> Thanks! >> --DIZZLE >> > > -- View this message in context: http://www.nabble.com/How-to-change-value-of-select-dropdown--tf2308098.html#a6433015 Sent from the JQuery mailing list archive at Nabble.com. _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/