views:

135

answers:

1

I have a function trying to run this:

 if ( action=='fadeIn' ) {
  if ( $( this ).css( 'position' ) == "static" ) {
   $( this ).css( {position: 'relative'} );
  }
  $( this ).append( '<span class="bg_fade">' )
 }
 var fader = $( this ).find( '.bg_fade' );

 alert(fader.attr('class'));

It works fine in Firefox, but in IE, the alert returns undefined. Any ideas?

The whole code is at http://www.jakelauer.com/jquery/bgFade/jquery.bgFade.js

Being used at jakelauer.com/jquery/bgFade

+1  A: 

It's almost certainly the fact that IE stops processing on errors somewhere else in the script. Press F12 to bring up developer tools, go to Script, and press Start debugging. Then reload your page. You'll find your error in a hurry.

EDIT: I took a closer look. Try closing your <span> tag in your append. The append is not going off in IE.

Plynx
Just tried this, no dice. The developer tools window didn't change at all on reload, or when I ran the function. If anybody's interested in testing it themselves, it's at www.jakelauer.com/jquery/bgFade
Jake
Awesome, it was the span tag. Thanks!
Jake