<h:selectOneMenu id="queueSelectMenu" styleClass="selectOneMenue-style"
tabindex="1" value="#{reworkQueueMB.queueType}" onselect="alert('2');" >
<f:selectItems value="#{queueMB.queueSelectItems}" />
</h:selectOneMenu>
When I choose the item of the selectmenu, I want to get the select event, but it doesn’t work.
I don’t want to use the change event, because when I select an item that is already selected, the change event will be triggered again.
The HTML DOM
selectevent is only triggered when you select (highlight) text in a text input field such as<input>and<textarea>. But the<h:selectOneMenu>renders a HTML<select>element, not an<input>element. It does not allow you for selecting text in the field. Theselectevent does nothing here.Technically, setting the
clickevent on every individual<option>element should work out for you.However, this does (unsurprisingly) not work in any IE browser, even not IE9.
Your best bet is really the
changeevent. This is fully crossbrowser. A completely different alternative is to use a radiobutton group instead -which can be rendered by<h:selectOneRadio>. Theclickevent should do exactly what you want.