You need to sign in to do that
Don't have an account?
rebvijkum
jquery for onclick event on hyperlinks doesn't work
Thje jquery for onclick event doesn't work. The requirement is when i click on any hyperlink in the visualforce page, the alert message shld popup.
My Code:
<apex:page standardController="Core_Benefit__kav" id="corebenefitpageid" applyBodyTag="false" sidebar="false" showHeader="true" >
<script>
j$ = jQuery.noConflict();
j$(document).ready(function() {
j$('.openInPopup a').click(function(event) {
alert( "Handler for .click() called." );
event.preventDefault();
window.open(j$(this).attr('href'));
});
});
</script>
<apex:includeScript value="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"/>
<knowledge:articleRendererToolBar articleId="{! $CurrentPage.parameters.id}" id="toolbarid" canVote="true" showChatter="true"/><br/><br/>
<apex:pageBlock mode="maindetail" id="pageblockid" >
<apex:tabPanel selectedTab="InformationTab" id="SingleTopicTabPanel" tabClass="activeTab" inactiveTabClass="inactiveTab" switchType="client">
<!-- INFORMATION TAB -->
<apex:tab label="Information" name="Information" id="InformationTab" >
<apex:pageBlockSection columns="1">
<apex:outputField id="exam" value="{!Core_Benefit__kav.Exam__c}"/>
<apex:outputField id="lens" value="{!Core_Benefit__kav.Lens__c}"/>
<apex:outputField id="lensenhancement" value="{!Core_Benefit__kav.Lens_Enhancements__c}"/>
<apex:outputField id="frame" value="{!Core_Benefit__kav.Frame__c}"/>
<apex:outputField id="contacts" value="{!Core_Benefit__kav.Contacts__c}"/>
<apex:outputField id="doctornetwork" value="{!Core_Benefit__kav.Doctor_Network__c}"/>
<apex:outputField id="lab" value="{!Core_Benefit__kav.Lab__c}"/>
</apex:pageBlockSection>
</apex:tab>
<!-- ADDITIONAL BENEFITS TAB -->
<apex:tab label="Additional Benefits" name="Additional Benefits" id="additionalbenefits" >
<apex:pageBlockSection columns="1">
<apex:outputField id="additionalbenefits" value="{!Core_Benefit__kav.Additional_Benefits__c}"/>
</apex:pageBlockSection>
</apex:tab>
<!-- STEPS TAB -->
<apex:tab label="Additional Steps" name="Steps" id="StepTab" >
<apex:pageBlockSection columns="1">
<apex:outputField id="adjustmentsteps" value="{!Core_Benefit__kav.Adjustment_Steps__c}"/>
<apex:outputField id="processingsteps" value="{!Core_Benefit__kav.Processing_Steps__c}"/>
<apex:outputField id="supportqueuesteps" value="{!Core_Benefit__kav.Support_Queue_Steps__c}"/>
</apex:pageBlockSection>
</apex:tab>
</apex:tabPanel>
<apex:iframe id="detailsframe" width="100%" scrolling="true"/>
</apex:pageBlock>
</apex:page>
My Code:
<apex:page standardController="Core_Benefit__kav" id="corebenefitpageid" applyBodyTag="false" sidebar="false" showHeader="true" >
<script>
j$ = jQuery.noConflict();
j$(document).ready(function() {
j$('.openInPopup a').click(function(event) {
alert( "Handler for .click() called." );
event.preventDefault();
window.open(j$(this).attr('href'));
});
});
</script>
<apex:includeScript value="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"/>
<knowledge:articleRendererToolBar articleId="{! $CurrentPage.parameters.id}" id="toolbarid" canVote="true" showChatter="true"/><br/><br/>
<apex:pageBlock mode="maindetail" id="pageblockid" >
<apex:tabPanel selectedTab="InformationTab" id="SingleTopicTabPanel" tabClass="activeTab" inactiveTabClass="inactiveTab" switchType="client">
<!-- INFORMATION TAB -->
<apex:tab label="Information" name="Information" id="InformationTab" >
<apex:pageBlockSection columns="1">
<apex:outputField id="exam" value="{!Core_Benefit__kav.Exam__c}"/>
<apex:outputField id="lens" value="{!Core_Benefit__kav.Lens__c}"/>
<apex:outputField id="lensenhancement" value="{!Core_Benefit__kav.Lens_Enhancements__c}"/>
<apex:outputField id="frame" value="{!Core_Benefit__kav.Frame__c}"/>
<apex:outputField id="contacts" value="{!Core_Benefit__kav.Contacts__c}"/>
<apex:outputField id="doctornetwork" value="{!Core_Benefit__kav.Doctor_Network__c}"/>
<apex:outputField id="lab" value="{!Core_Benefit__kav.Lab__c}"/>
</apex:pageBlockSection>
</apex:tab>
<!-- ADDITIONAL BENEFITS TAB -->
<apex:tab label="Additional Benefits" name="Additional Benefits" id="additionalbenefits" >
<apex:pageBlockSection columns="1">
<apex:outputField id="additionalbenefits" value="{!Core_Benefit__kav.Additional_Benefits__c}"/>
</apex:pageBlockSection>
</apex:tab>
<!-- STEPS TAB -->
<apex:tab label="Additional Steps" name="Steps" id="StepTab" >
<apex:pageBlockSection columns="1">
<apex:outputField id="adjustmentsteps" value="{!Core_Benefit__kav.Adjustment_Steps__c}"/>
<apex:outputField id="processingsteps" value="{!Core_Benefit__kav.Processing_Steps__c}"/>
<apex:outputField id="supportqueuesteps" value="{!Core_Benefit__kav.Support_Queue_Steps__c}"/>
</apex:pageBlockSection>
</apex:tab>
</apex:tabPanel>
<apex:iframe id="detailsframe" width="100%" scrolling="true"/>
</apex:pageBlock>
</apex:page>
All Answers