Note that there are some explanatory texts on larger screens.

plurals
  1. POHide/show div not working in IE7
    primarykey
    data
    text
    <p>I have taken over a WordPress site that uses jquery to show/hide content in a frame when clicking a link in a another div. This works perfectly in all browsers except IE7. In IE7, nothing happens. Nothing at all. And it doesn't throw any errors. Here is the code I'm using</p> <p>HTML:</p> <pre><code>&lt;div id="campaignCards" class="contentBody"&gt; &lt;?php $args = array( 'post_type' =&gt; 'home_promos', 'posts_per_page' =&gt; 8, 'order' =&gt;'ASC' ); $postcount = 0; $loop = new WP_Query( $args ); while ( $loop-&gt;have_posts() ) : $loop-&gt;the_post(); ?&gt; &lt;a class="slideLink" href="&lt;?php if(get_post_meta($post-&gt;ID, 'mcb2b_home_promos_link', true)) { echo get_post_meta($post-&gt;ID, 'mcb2b_home_promos_link', true); } ?&gt;"&gt; &lt;div class="campaign_card" id="card&lt;?php echo $postcount; ?&gt;"&gt; &lt;?php the_content();?&gt; &lt;/div&gt; &lt;/a&gt; &lt;? $postcount++; endwhile; ?&gt; &lt;/div&gt; &lt;div id="homebuttons"&gt; &lt;ul&gt; &lt;?php $args = array( 'post_type' =&gt; 'home_promos', 'posts_per_page' =&gt; 8, 'order' =&gt;'ASC' ); $postcount = 0; $loop = new WP_Query( $args ); while ( $loop-&gt;have_posts() ) : $loop-&gt;the_post(); ?&gt; &lt;li class="campaignPicker"&gt; &lt;a href="javascript:showonlyone('card&lt;?php echo $postcount; ?&gt;');"&gt; &lt;?php if (has_post_thumbnail()) {the_post_thumbnail();} ?&gt; &lt;/a&gt; &lt;/li&gt; &lt;?php $postcount++; endwhile; ?&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre> <p>JS</p> <pre><code>function showonlyone(thechosenone) { var campaign_card = document.getElementsByTagName("div"); for(var x=0; x&lt;campaign_card.length; x++) { name = campaign_card[x].getAttribute("class"); if (name == 'campaign_card') { if (campaign_card[x].id == thechosenone) { campaign_card[x].style.display = 'block'; } else { campaign_card[x].style.display = 'none'; } } } } </code></pre> <p>I think the problem is in the <code>var campaign_card = document.getElementsByTagName("div");</code> but I'm not proficient with jquery to debug in IE. Any help would be greatly appreciated.</p> <p>Thanks </p>
    singulars
    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.
 

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