0

IE 8, 7, and 6 are all complaining about the same character in the below snippet:

else if (page == "/about") {

    $.address.title("About");

    $('#main').load("about.php", function () { 
    });  <=  This character (the semi colon)
}

You'll see three javascript errros with IE 8 all pointing to the same character. Am I missing something or is this an invalid character in older version of IE?

12
  • Have you tried actually putting something inside of the function? Commented Sep 23, 2011 at 15:30
  • 2
    No, something else must be going on. Commented Sep 23, 2011 at 15:30
  • 1
    There has to be an issue with some other code. auto-added semi-colons or missing braces or semi-colon maybe? you would need to provide an example or more code for us to help. Commented Sep 23, 2011 at 15:31
  • 1
    Can you post more code... and maybe the error you're receiving? Can you replicate it on jsfiddle or point us to a working copy? Commented Sep 23, 2011 at 15:33
  • 1
    It's almost a guarantee that you have a stray comma somewhere. That is: {'a':3, 'b':2,} will break in IE. If you have a decent IDE, this will get marked and picked up as an error. Intelli-J does this, at least. Commented Sep 23, 2011 at 15:47

2 Answers 2

1

For anyone else who has a similar issue, here was the problem. As mentioned below the error returned from IE was not even close to the correct location. That aside here is what happened. I had a php variable mixed with javascript like so:

<textarea class="question_text" id="1" name="1" onFocus="if (this.value == <?php echo($question[0]['question_text']); ?>) { this.value = ''; }"><?php echo($question[0]['question_text']); ?></textarea>

I needed to add quotes around the php value retured like so:

<textarea class="question_text" id="1" name="1" onFocus="if (this.value == <?php echo("$question[0]['question_text']"); ?>) { this.value = ''; }"><?php echo("$question[0]['question_text']"); ?></textarea>
Sign up to request clarification or add additional context in comments.

Comments

0

According to my debugger, your 1st of 3 syntax errors is here: $.address.title("Edit Profile");

2 Comments

That looks perfectly fine to me...what am I missing?
Not sure, but it's throwing errors at all the similar syntaxes: $.address.title("whatever"); Is your dollar sign colliding with any other libraries? Modernizer perhaps? Is the address plugin know to work in IE8 in this configuration?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.