aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes IE - 'html()' is null or not an object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "IE - Watch "IE - New topic
Author

IE - 'html()' is null or not an object

Melcolm Aslam
Greenhorn

Joined: Aug 21, 2012
Posts: 5
I only get this error in IE browser and not in firefox.

here is my code that is causing this Error:

if($('#isAll').exists()

&& $("#ErrorMsgDiv").html().trim()==""

&& $("#AjaxErrorMsgDiv").html().trim()!=""){

$("#ErrorMsgDiv").html($("#AjaxErrorMsgDiv").html());

}


please help
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61066
    
  66

Is jQuery getting properly loaded in IE?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Melcolm Aslam
Greenhorn

Joined: Aug 21, 2012
Posts: 5
yes everything works perfectly normal in firefox. In internet exploer I get this message 'html()' is null or not an object " . I know that it is a syntax error that is not supported by IE browser.

here is the image of the exact message.



[Download error.bmp] Download

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61066
    
  66

You didn't answer my question.
Melcolm Aslam
Greenhorn

Joined: Aug 21, 2012
Posts: 5
how do i confirm if it is getting loaded properly?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61066
    
  66

Use the browser's debugger it will show everything that's going on. Or, does jQuery work elsewhere? Is this happening at page load? Or as the result of an event?
Melcolm Aslam
Greenhorn

Joined: Aug 21, 2012
Posts: 5
It is a result of an event.

When i click pagination " first, previous, 1,2,3,4,5, last"




Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61066
    
  66

OK, so if there are no errors before that, it's likely jQuery has loaded. I assume that there are no other errors appearing before that?

Is the .html() function used elsewhere? Try using one in the ready handler and see if it generates an error.

Which line is 216? (And in the future, please copy/past error text rather than attaching an image.)
Melcolm Aslam
Greenhorn

Joined: Aug 21, 2012
Posts: 5
alright thank you so much i fixed the issue


&& $("#ErrorMsgDiv").html().trim()==" "

&& $("#AjaxErrorMsgDiv").html().trim()!=" ")

instead of

&& $("#ErrorMsgDiv").html().trim()==""

&& $("#AjaxErrorMsgDiv").html().trim()!="")


there should be a a space between the quotes cause some browsers can not read that meaning clearly
 
Consider Paul's rocket mass heater.
 
subject: IE - 'html()' is null or not an object