Jump to content

simple jQuery problem.. hopefully!


Chud37

Recommended Posts

Hello,

 

I have an external jquery.shop.js file, and there are three pages where I need a donation box to popup.  I built it on the first page, and it works fine, looks beautiful, etc.  But when I implement the same code on the other two pages, it refuses to popup.  I know the jquery file is referenced correctly and loading, because other functions in there are performing on the other pages too.  But i cannot get any response out of it.

 

It confuses me, because the code is the same, both in the HTML and the Jquery.  What is stopping the [.click] function from performing?

 

here is the code:

 

$('#donateButton').click(function(){
alert('hello');
if(popupStat==0) {
popupStat=1;
$('#donationPopup').center();
$('#donationPopup').fadeIn('slow');
$('#content').fadeTo('slow', 0.2);
}
});
$('#closeButton').click(function(){
if(popupStat==1) {
popupStat=0;
$('#donationPopup').fadeOut('slow');
$('#content').fadeTo('slow', 1);
}
});

I put the alert hello in there to try and debug somewhat, and again, i get the alert on the first page, but the second and third pages are not showing anything at all. 

 

I am fairly new to jQuery, but not to programming.  But this seems to be a re-occuring problem for me.  Does it make a difference in what order my functions are placed in the .JS file? how could i further debug this?  Can anyone help?

 

Thanks,

 

~Richard

Link to comment
https://forums.phpfreaks.com/topic/262820-simple-jquery-problem-hopefully/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.