Here is my query. I am designing UI (in JSF) for license agreement page where "next" button will be enabled or disabled based on user's choice for accepting or denying the license agreement. Accept and decline buttons are radio buttons. I am using jquery for that. Here is jquery snippet:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js">
$('#pg2\\:accept').click(function() {
alert("hello");
if ($(this).is(':checked'))
$('#next').removeAttr('disabled');
else
$('#next').attr('disabled', 'disabled');
});
}
</script>
Here is my JSF code:
<h:panelgroup id="pg2">
<h:selectOneRadio id="radios" layout="pageDirection">
<f:selectItem id="accept" itemValue="#{true}" itemLabel=ACCEPT/>
<f:selectItem id="decline" itemValue="#{false}" itemLabel=DECLINE/>
</h:selectOneRadio>
</h:panelGroup>
<h:commandButton id="next" action="welcome" value="Next" widgetVar="nxt" />
Edit: replaced primefaces components with Jsf components as I cant use primefaces in my code