I am learning JSF and want to integrate it with jQuery. But it is not working properly as page is refreshed on its own. I have tried e.preventDefault
and e.stopPropagation
too, but without success.
Here is jQuery code:
$(document).ready(function(){
$("#form2\\:button1").click(function(){
$("#form2\\:div1").toggle("slow",function(e){
//e.preventDefault;
//e.stopPropagation;
return false;
});
});
});
and here is xHTML part:
<h:form name="form1" id="form2">
<h:outputLabel value="Enter Date"></h:outputLabel>
<h:inputText value="#{test.date }"></h:inputText>
<h:commandButton action="#{test.doWork}" value="Submit Form"></h:commandButton>
<h:button id="button1" value="Action"></h:button>
<h:panelGroup layout="block" id="div1">
<h:commandLink id="link1" value="Edit Details"></h:commandLink>
<h:commandLink id="link2" value="Manage mails" > </h:commandLink>
</h:panelGroup>
</h:form>
I am trying to apply jQuery function on #button1
.