I have a PrimeFaces 5.1 <p:selectOneMenu>
that generates in DOM the following select:
<select id="WorkSpace:test:selectYear_input"
name="WorkSpace:test:selectYear_input" tabindex="-1">
<option value="" selected="selected">-- Year --</option>
<option value="2015">2015</option>
<option value="2014">2014</option>
<option value="2013">2013</option>
<option value="2012">2012</option>
<option value="2011">2011</option>
<option value="2010">2010</option>
<option value="2009">2009</option>
</select>
I have a <p:commandButton>
that triggers a jQuery function that will handle changing my <p:selectOneMenu>
.
<p:commandButton onclick="changeDropDownList();" />
jQuery function:
function changeDropDownList()
{
$('[id$=selectYear_input]')[0].selectedIndex = 2;
}
The <p:selectOneMenu>
is not updated. How is this caused and how can I solve it?