Note that there are some explanatory texts on larger screens.

plurals
  1. POUpdating my jQuery broke my show/hide
    primarykey
    data
    text
    <p>I have a script that changes a phone number, but this script will only work with jquery 1.6.4 -- it ceased to function once I updated to 1.7.2. What am I missing?</p> <pre><code>&lt;script type="text/javascript"&gt;// &lt;![CDATA[ $('a#reno-trigger').click(function(){ $('#toggle-lv').show(); $('#toggle-reno').hide(); }); $('a#lv-trigger').click(function(){ $('#toggle-reno').show(); $('#toggle-lv').hide(); }); // ]]&gt;&lt;/script&gt; </code></pre> <p>HTML:</p> <pre><code>&lt;div id="toggle-reno"&gt;&lt;div class="toggle-switch" &gt; &lt;span class="active"&gt;Las Vegas&lt;/span&gt; | &lt;a id="reno-trigger" href="#"&gt;Reno&lt;/a&gt;&lt;/div&gt; &lt;div class="toggle-phone"&gt;702.555.5555&lt;/div&gt; &lt;/div&gt; &lt;div id="toggle-lv" style="display: none"&gt;&lt;div class="toggle-switch" &gt; &lt;a id="lv-trigger" href="#"&gt;Las Vegas&lt;/a&gt; | &lt;span class="active"&gt;Reno&lt;/span&gt;&lt;/div&gt; &lt;div class="toggle-phone"&gt;555.555.5555&lt;/div&gt; &lt;/div&gt; </code></pre> <p>I am going to remove this line and the script will no longer work:</p> <pre><code>&lt;script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"&gt;&lt;/script&gt; </code></pre> <p>I took out the CDATA as well.</p> <p>My wordpress is loading a local version of 1.7.2.</p> <pre><code>&lt;script type='text/javascript' src='http://xxx.com/wp-includes/js/jquery/jquery.js?ver=1.7.2'&gt;&lt;/script&gt; </code></pre> <p>I've added:</p> <pre><code>&lt;script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"&gt;&lt;/script&gt; </code></pre> <p>And it works again, but I am loading two jQueries which seems strange.</p> <p>I guess it isn't the update of jQuery after all...</p> <p>The document.ready is implemented now:</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready( $('a#reno-trigger').click(function(){ $('#toggle-lv').show(); $('#toggle-reno').hide(); }); $('a#lv-trigger').click(function(){ $('#toggle-reno').show(); $('#toggle-lv').hide(); }); ); &lt;/script&gt; </code></pre> <p>That script didn't work period, I must have screwed up the document.ready part... I've put it back for now.</p>
    singulars
    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.
 

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