Greetings, I am trying to observe a <select> element's value changing when its value changes programmatically. The observation works when a human changes the select's value, but not when the javascript changes it.
I know that I could add some more logic to the button push, but would like to avoid that if possible and simply register the observing conditions for the select. Here is a code snippet: <html> <head> <script language="javascript" type="text/javascript" src="/javascript/prototype/prototype.js"></script> <script language="javascript" type="text/javascript"> Event.observe(window, 'load', function() { Event.observe('phones', 'change', alertme); Event.observe('clicker', 'click', changevalue); }); function alertme() { alert("Yo! it has changed"); } function changevalue() { $('phones').selectedIndex = 2; } </script> </head> <body> <select id="phones"> <option>cell</option> <option>land line</option> <option>TTY</option> <option>car</option> <option>boat</option> </select><br/> <button id="clicker">Click me to change the value to TTY!</button> </body> </html> -- Matt Zagrabelny - mzagr...@d.umn.edu - (218) 726 8844 University of Minnesota Duluth Information Technology Systems & Services PGP key 1024D/84E22DA2 2005-11-07 Fingerprint: 78F9 18B3 EF58 56F5 FC85 C5CA 53E7 887F 84E2 2DA2 He is not a fool who gives up what he cannot keep to gain what he cannot lose. -Jim Elliot
signature.asc
Description: This is a digitally signed message part