I'm trying to select an option from a select, but by value, and not by index. I'm trying like this:
function selectOptionByValue(selectID,valor){ var found = false; var i = 0; while(!found && i<selectID[0].options.length){ if(selectID[0].options[i].value == valor) { selectID[0].options[i].selected=true; found = true; } i++; } } I would call this function passing as argument the DOM object of the select and the option value that should be selected. Is there an easier way of doing this? BTW, it's not working for me. -- Martín Marqués select 'martin.marques' || '@' || 'gmail.com' DBA, Programador, Administrador --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---