Page 1 of 1

jQuery .slideDown() issue in IE

Posted: Tue Oct 25, 2011 9:43 pm
by TonsOfFun
Hello,
I am new to JavaScript and jQuery.
Here is the HTML:

Code: Select all

			
<section>
	<h2></h2>
	<section></section>
	<a href="">View</a>
</section>
Here is the JavaScript:

Code: Select all

$(document).ready(function(){
	$('.content').click(function(){
		url = $(this).attr('href');
		content = $(this).prev().html();
		if(content === '') {			
			$(this).prev().load(url,function(){
				$(this).slideDown(400);
				$(this).next().html('Close');
			});
		} else {
			$(this).prev().slideUp(400,function(){
				$(this).html('');
			});
		}

		if($(this).html() === 'View') {
			$(this).html('<img src="img/loading.gif">');
		} else {
			$(this).html('View');
		}
		return false;
	});
	$('.close').click(function(){
		$(this).prev().slideUp(400,function(){
			$(this).html('');
		});
		$(this).html('View').attr('class','button content');
		return false;
	});
});
When a user clicks the link it will replace the link text with a loading gif and once the data loads the gif is replaced with "Close" and the section right before slides down with the data.

It works fine in every browser except IE8 and below where it shows the loading gif and and says there is an error in the script and never loads/shows the data.

How can I fix it?

Also if you have any suggestions on how to clean up the code, that would be great. :)

Thanks.

Re: jQuery .slideDown() issue in IE

Posted: Sat Oct 29, 2011 3:35 am
by KCAstroTech
TonsOfFun wrote:and says there is an error in the script
What is the error?

Re: jQuery .slideDown() issue in IE

Posted: Sat Oct 29, 2011 8:32 am
by uday8486
Is the function not working at all? Or is it not giving the desired effect?