Shruti
Shruti

Reputation: 721

Custom jQuery function not working in Firefox

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);" />

Upvotes: 0

Views: 494

Answers (4)

Guffa
Guffa

Reputation: 700442

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'));"

Upvotes: 4

Vladislav Rastrusny
Vladislav Rastrusny

Reputation: 29985

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

Upvotes: 0

cllpse
cllpse

Reputation: 21727

Try Changeing:

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

to:

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

Upvotes: 0

belugabob
belugabob

Reputation: 4460

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?

Upvotes: 1

Related Questions