+ Start a Discussion
sfdcksfdck 

Jquery with visualforce

<apex:page >
 <apex:includeScript value="{!URLFOR($Resource.Jquery, 'js/jquery-1.9.0.custom.min.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.Jquery, 'js/jquery-ui-1.9.0.custom.min.js')}"/>
<apex:stylesheet value="{!URLFOR($Resource.Jquery, 'css/ui-lightness/jquery-ui-1.9.0.custom.css')}"/> 
 
<script type="text/javascript">
var j$ = jQuery.noConflict();

j$(document).ready(function(){
j$("#jqexample").click(function() {
alert("Jquery example!!!!!");
});
});
</script>

 <a id="jqexample" href="">jqexample!</a> 

</apex:page>

 

 

 

jquery is not working with with the above code . were is the problem ?  Guys help needed

Best Answer chosen by Admin (Salesforce Developers) 
JHayes SDJHayes SD

This worked fine for me:

 

<apex:page >
 <apex:includeScript value="{!$Resource.JQuery_1_7_2}"/> 
<script type="text/javascript">
var j$ = jQuery.noConflict();

j$(document).ready(function(){
j$("#jqexample").click(function() {
alert("Jquery example!!!!!");
});
});
</script>

 <a id="jqexample" href="">jqexample!</a> 

</apex:page>

 The only difference in my code is that I replaced the URLFOR calls with a direct reference to the resource.

 

Regards, jh

All Answers

JHayes SDJHayes SD

This worked fine for me:

 

<apex:page >
 <apex:includeScript value="{!$Resource.JQuery_1_7_2}"/> 
<script type="text/javascript">
var j$ = jQuery.noConflict();

j$(document).ready(function(){
j$("#jqexample").click(function() {
alert("Jquery example!!!!!");
});
});
</script>

 <a id="jqexample" href="">jqexample!</a> 

</apex:page>

 The only difference in my code is that I replaced the URLFOR calls with a direct reference to the resource.

 

Regards, jh

This was selected as the best answer
sfdcksfdck

Hi JHayes,

        

                   Thanks for the reply , code is alright but the alert box is not working for me .

                    please check.

JHayes SDJHayes SD

Obvious question but do you have a pop-up blocker enabled?