Note that there are some explanatory texts on larger screens.

plurals
  1. POShow/hide div with iFrame: Syntax error, unrecognized expression #
    primarykey
    data
    text
    <p>I have a page with multiple hidden divs. When the corresponding link is clicked, the div content reveals itself while hiding any other divs that may have been opened. I have this functionality working successfully without errors <a href="http://cookware.lecreuset.com/cookware/content_warranty-information_10151_-1_20002" rel="nofollow">here</a>. It's a simple show/hide, nothing fancy.</p> <p>Now I am building a new page, which is pretty much exactly the same except one div has an iFrame in it, which is pulling in a page with a newer version of jQuery on it (the site in question is running 1.3.2 which I can't upgrade, unfortunately).</p> <p>When I try to leave this new page by clicking another link in the site, I see "Syntax error, unrecognized expression: #" in Firefox, and in IE8, it says Line: 19 Error: Exception thrown and not caught, followed by "Syntax error, unrecognized expression: ad+" when I click Yes to debug. Then I get another error telling me "Object doesn't support property or method" for this line:</p> <pre><code> $("#" + $(this).attr("class")).show().siblings('div').hide(); </code></pre> <p>Is this happening because of the second jQuery library used on the page in the iFrame? Its the only thing I can think of as to why it works on one page and not the other.</p> <p><a href="http://jsfiddle.net/v6FwM/4/" rel="nofollow">Here is a fiddle</a> with the code - if you click on the Home link at the top of the page you can see the syntax error in the console.</p> <p>Here is the complete contents of the script tag on the page. When I remove this I have no errors so it's gotta be something here. I did notice the mix of single and double quotes but still got the error when I tried to change it to one or the other:</p> <pre><code> $(document).ready(function() { // Optional code to hide all divs $("div" + ".menu").hide(); // Show chosen div, and hide all others $("a").click(function () { $("#" + $(this).attr("class")).show().siblings('div').hide(); }); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload