+ Start a Discussion
Deepak PansariDeepak Pansari 

Onclick event is not working gwith <apex:Tab>

Hi All,


I have below test Visualforce page , in which i am trying to call onclick event for tab but it not working.


Can someone help me ..





<apex:page standardController="Account" ><head> <script language="javascript"> function setfirst() { alert("first"); } function setsecond() { alert("second"); } </script></head> <apex:tabPanel switchType="client" selectedTab="tabdetails" id="tabPanel"> <apex:tab label="General" name="General" id="tabGeneral" onclick="setfirst()"> </apex:tab> <apex:tab label="Professional" name="Professional" id="tabProfessional" onclick="setsecond()"> </apex:tab> </apex:tabPanel></apex:page>







I think it works, just not the way you might want it to.

I implemented your code snippet, and when I click on the Tab itself (where the label is rendered) nothing happens.  But, when I click on the tab body (the area below the tab label), the alert is displayed.

Not sure why that is, or how to get your desired result, but wanted to provide an update.



I am also facing the same problem....can anyone tell me is there any work around for this......

when i am trying to click on tab nothing is happening but on click of tabarea desired fuctionalty is working


You have to use onTabEnter instead of onClick


I was facing same issue but it resolved with onTabEnter.

Thanks all 


TabEntre attribute is not supported in <apex:tab>.pls let me know how to use it.

  I used "ontabenter" event to call javascript function Ex <apex:tab label="Projects" name="projectTab" id="projectTab" ontabenter="ShowAlert();"/>