Link to home
Create AccountLog in
Avatar of dolythgoe
dolythgoe

asked on

jquery click event not working in IE 7 or 8

I've spent ages reading and trying different things to work but I can't get the onclick event to work in IE like it does in every other browser!

The link code:

<a href="#" id="signupopen">QUICK SIGNUP</a>

Open in new window


js is called before in the <head> (tried putting it at bottom too but didn't work

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" src="js/jquerywindow.js"></script>

Open in new window


jquery code in jquerywindow.js :

		$('#signupopen').click(function() {
			$signup.load('signup.php').ready(
			$signup.dialog('open'));
			// prevent the default action, e.g., following a link
			return false;
		});

Open in new window


Also tried:

		$('#signupopen').live("click", function() {
			$signup.load('signup.php').ready(
			$signup.dialog('open'));
			// prevent the default action, e.g., following a link
			return false;
		});

Open in new window


To no avail :(

Would love some help through this IE deugging nightmare!
Avatar of chaitu chaitu
chaitu chaitu
Flag of India image

its working for me.

$('#signupopen').click(function() {
alert("aa")
			$signup.load('signup.php').ready(
			$signup.dialog('open'));
			// prevent the default action, e.g., following a link
			return false;
		}); 
});
 	/*	$('#signupopen').live("click", function() {
			$signup.load('signup.php').ready(
			$signup.dialog('open'));
			// prevent the default action, e.g., following a link
			return false;
		}); */
  </script>
 </HEAD>

 <BODY>



 		

  <a href="#" id="signupopen">QUICK SIGNUP</a> 

Open in new window

put these js files at the top of document.ready.use   $(document).ready(function() {
});
  $(document).ready(function() {

$('#signupopen').click(function() {
alert("aa")
			$signup.load('signup.php').ready(
			$signup.dialog('open'));
			// prevent the default action, e.g., following a link
			return false;
		}); 
});

Open in new window

Avatar of dolythgoe
dolythgoe

ASKER

Sorry forgot to say they already are in this function and still no luck :(
atleast are you getting alert?

$(document).ready(function() {

  $('#signupopen').click(function() {
		alert("aa")
			$signup.load('signup.php').ready(
			$signup.dialog('open'));
			// prevent the default action, e.g., following a link
			return false;
		}); 
});
  </script>
 </HEAD>

 <BODY>

  <a href="#" id="signupopen">QUICK SIGNUP</a>  

Open in new window

instead of hyperlink if u use button then whats hapening.

  <input type='button' value='click' id="signupopen">QUICK SIGNUP</a>  
Yes it's ok when I paste it into the top like you show..

But not as a seperate script which is full of other similar functions etc..

Cheers
ASKER CERTIFIED SOLUTION
Avatar of chaitu chaitu
chaitu chaitu
Flag of India image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Cool...

Well, it was a rogue comma that IE didn't like.

I had this before the function:

		var $resend = $('#resend')
			.dialog({
				autoOpen: false,
				title: 'Activation Required',
				draggable: false,
				modal: true,
				resizable: false,
				width: 420,
				height: 360,
				position: ['center',100],

				
			});

Open in new window


I did read about this and thought I'd removed all trailing commas but one remained after position: ['center',100]. I removed this and all works fine :D

Thanks for your help sorting this out!