Yep, that was me just staring for too long at one chunk of code. Thanks to the kind users who pointed out my very silly extraneous .change() at the end.
I hope this saves someone else from a similarly overlooking something so relatively obvious. -c On Dec 1, 2:46 pm, chickenofeathers <[EMAIL PROTECTED]> wrote: > I've tried to understand "bubbling" and I think my problem has something to > do with that, but I'm not sure. Basically, it seems to me that an event > fires on a SELECT element even when the page simply loads. > > I need to know how to either: > > a.) prevent this initial firing, so that my .change function is only > processed when the user actually does something (whether with the keyboard > or the mouse), > or > b.) figure out how to distinguish between the two kinds of event firing > (window just loading versus user actually doing something). > > Right now, the #textInputExample INPUT element gets overwritten by the > returned contents from something.php the second the page loads (before the > user has had a chance to even view the original contents of the box). > > $(function(){ > $("select#foo").change(function() { > var str = $("#foo option:selected").val(); > $.post("something.php", > {filepath: str}, > function(xml) { > $("#textInputExample").val($("blort", xml).text()); > }); > }).change(); > > }); > > <select id="foo"> > <option value="lalala">lalala</option> > <option value="hmmmm">hmmmm</option> > </select> > > <input type="text" id="textInputExample" value="" /> > > -- > View this message in > context:http://www.nabble.com/Event-handling%2C-bubbling%2C-and-SELECT-change... > Sent from the jQuery General Discussion mailing list archive at Nabble.com.