views:

95

answers:

4

I have written one custom paremeterized jquery function for fadein and fade out. That function works fine in IE but not in firefox. The function is :

jQuery.fn.dcFadeIn = function(newDiv) {
    var openDiv = newDiv;

    return $(openDiv).fadeIn();
};

<input type="radio" name="doc3" value="independentCall" class="radioButton" id="indMetaCalls1" onClick="jQuery.fn.dcFadeIn(indCallDetailsDoc1);" />
+1  A: 

Do you have javascript enabled in FireFox?

If so, can you show the markup for 'indCallDetailsDoc1'?

Also, why don't you use 'newDiv' directly, instead of copying it into 'openDiv' first?

belugabob
A: 

Try Changeing:

onClick="jQuery.fn.dcFadeIn(indCallDetailsDoc1);"

to:

onClick="jQuery.fn.dcFadeIn(this);"
roosteronacid
That was my original thought, then I realised that this would result in the function being passed a reference to 'indMetaCalls1' instead of 'indCallDetailsDoc1'
belugabob
A: 

What is "indCallDetailsDoc1" and why do you call functions using jQuery.fn.dcFadeIn()? You cannot call plugin functions like this.

Please consider reading this page to learn write jQuery plugins: http://docs.jquery.com/Plugins/Authoring

FractalizeR
+4  A: 

You are refereing to an element as if it is a member of the windows object. Only IE puts elements in the windows object, so that doesn't work in any other browser.

Use the JQuery object to get a reference to the element:

onClick="jQuery.fn.dcFadeIn($('#indCallDetailsDoc1'));"
Guffa
Doh - so obvious, when it's pointed out!
belugabob