I want to fade out my apex:pagemessage
when I click anywhere on the window. For that jquery gives a simple way :
$(window).click(function(){$("#id").fadeOut();});
But here I am not able to use the <apex:pagemessage>
id within my jquery. How can I access this element?
<apex:page extensions="arema">
<script>
$(window).click(function(){$("#showmsg").fadeOut();});
</script>
<apex:pageMessages id="showmsg"></apex:pageMessages>
<apex:commandButton action="{!saveTemplate}" value="Show Message" rerender="showmsg"/>
</apex:page>
Apex class
global class arema{
public void saveTemplate()
{
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.CONFIRM,'Saved changes successfully'));
}
}