Jitendra Vyas
Jitendra Vyas

Reputation: 152787

'$.fn' is null or not an object

Problem 1

Error: Microsoft JScript runtime error: '$.fn' is null or not an object

Error area:

    $.fn.apply=function(item,content,header){

        $(".featureBox"+item).css('z-index', "1000");
        $("img.featureBox" + item +"top").attr("src",basepath + "box-big-top.jpg");
        $("img.featureBox" + item +"imgcut").attr("src",basepath + "box-big-img"+item+".jpg");
        featureboxcont[item].attr("src",basepath + "box-big-cont.jpg");
        $("img.featureBox" + item +"foot").attr("src",basepath + "box-big-bot2.jpg");
        //$("#NoteModalDialog > #x-dlg-bd > #x-dlg-tab > #acc-ct")

        $("#box"+item+"headtext > .h2div > h2").text(header);
        $("#box"+item+"bottext").css({"top":"181px","width":"205px","font-size":"12px","color":"#ffffff","left":"10"});
        $("#box"+item+"foottext").css({"top":footheight+"px","width":"215px","left":"20"});
        $("#box"+item+"hidden").css({"display":"block"});
        $("#box"+item+"bottext").text(content);
        $("#box"+item+"headtext > .h2div > h2").removeClass("sIFR-replaced");
        callsIFR();
    }

Problem 2

Error : Microsoft JScript runtime error: 'null' is null or not an object

Error area :

$("#innerWrapper").addClass("js-version");

I'm also using protoype.js on page.

Upvotes: 2

Views: 4805

Answers (4)

spliter
spliter

Reputation: 12589

For the Problem 1 you could solve the conflicts with the prototype.js by just using

jQuery.fn.apply = …

Then you avoid the conflict between the two libraries.

Upvotes: 0

T.J. Crowder
T.J. Crowder

Reputation: 1075109

If you're using jQuery and Prototype on the page, $.fn will indeed likely be undefined at global scope. The only way to use jQuery and Prototype on the same page is to use jQuery.noConflict and give it a different symbol than $, which Prototype also uses.

Upvotes: 1

Mottie
Mottie

Reputation: 86443

It sounds like your problem is that both prototype and jQuery use the $ function/variable name. Check out this page on how to set jQuery to not conflict with prototype.

Upvotes: 2

Tim Hoolihan
Tim Hoolihan

Reputation: 12396

Why do you have apply in the declaration? apply is used to specify this with a method. typically you would do something like this...

var object1 = {X:"stuff"};

var $.fn = function () {
   /* substitute your method here */
   this.X = this.X || "default";
   alert(this.X);
};

$.fn.apply(object1);

Upvotes: 0

Related Questions