Try observing the SELECT for the 'change' event, and then check the current value of the SELECT. The OPTION element won't receive the focus event. Try something along the lines of:
document.observe("dom:loaded", function(){ $("select").observe("change", function(){ if ($("select").value == "Englisch") { // do something } }); }); That snippet, along with the markup, can be cleaned up and optimized a good deal further, but that should get the basic event working properly. Alex On Thu, Aug 27, 2009 at 8:01 AM, clicforw...@googlemail.com < clicforw...@googlemail.com> wrote: > > Hello, > > I need to change content of a dom element on select a option. > I tried to handel it like this: > > <script type="text/javascript"> > > document.observe("dom:loaded", function() { > $('#englisch').onfocus = function() { > $('div').replace('<p>This is English</p>'); > } > }); > </script> > > > <select name="select"> > <optgroup> > <option>Select Language</option> > <option id="englisch">Englisch</option> > <option id="german">German</option> > </optgroup> > > > But nothing happens. > Can anyone help me out? > > Thanks! > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to prototype-core-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~----------~----~----~----~------~----~------~--~---