Wednesday, September 8, 2010

Null is Null or not an object Jquery, javascript, ajax, asp.net, lightbox, prototype, js

Sometimes when you are opening some web pages you will receive the following error message

Null is Null or not an object

The error message is comming in the following situations

Jquery.js and prototype.js

You may be using jQuery.js and prototype.js in same html file in such case the confusion will come to the program if you are using '#' to identify jquery objects. So you replace '#' with 'jQuery' and get solve the issue

document.getElementById('') is null

Sometimes you will use a document.getElementById('') to find some controls and and will use that controls in that case you make sure the object is not null

2 comments:

  1. I have this function on javascript:

    function copyDate(to_date, from_date){
    return to_date.set({
    day: from_date.getDate(),
    month: from_date.getMonth(),
    year: from_date.getFullYear()
    });
    }

    The second line of the function raises an error on IE8 , the error message is similar to yours. ("Null is Null or not an object").
    I have debug it using console.log on firefox and chrome, and it seems no problems on those browser. Can you help me?

    Kind Regards,
    Yosef Kevin
    codingexplorer.blogspot.com
    PIN : 21AD562F
    MSN : yosef.kevin@hotmail.com
    YM : yosef.kevin
    Gtalk : yosef.kevin

    ReplyDelete
  2. Thanks. That was very helpful.

    ReplyDelete