0

I get the following error "Objected Expected" on line 5 of this code in IE8, the code works in Firefox but not IE 8 which is the browser I am developing for. Thanks.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>    
<script language="javascript">

$(document).ready(function(){
if($('#DialogFinalMessage > div').html().length>0){
    window.location.href = "<Desired destination page URL>"
 }
});
</script>
6
  • 1
    What is line 5 in your code? Commented Aug 2, 2013 at 10:23
  • $(document).ready(function(){ Commented Aug 2, 2013 at 10:28
  • Really? Where is the <doctype>, the <html> etc..? Or is it only in this bit of code line 5? Commented Aug 2, 2013 at 10:30
  • Thats just a snippit of the code, I have over 800 lines but the problem lies within this code! Commented Aug 2, 2013 at 10:31
  • $('#DialogFinalMessage > div').html() will return null/undefined if it did not find any elements matching the selector. Check if any elements were found before trying to get their source. Commented Aug 2, 2013 at 10:32

2 Answers 2

0

Problem: Demo

Try

$(document).ready(function(){
    var html = $('#DialogFinalMessage > div').html();
    if(html != undefined && html.length > 0){
        window.location.href = ""
    }
});

Demo: Fiddle

Sign up to request clarification or add additional context in comments.

Comments

0

Try <script type="javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.