Note that there are some explanatory texts on larger screens.

plurals
  1. POHidden content when using jQuery on IE7
    primarykey
    data
    text
    <p>I'm using jQuery to switch between 'simple' and 'advanced' search panels by sliding up/down the panels. After the slide I want to set the input focus to the first field, however this causes the panel to blank out on IE7. It doesn't happen on FF 3.5.1</p> <p>The original code is using ASP.NET but I've managed to reproduce it with some simple HTML and JavaScript below. My first attempt was based on tables rather than divs, but the same problem occurred.</p> <p>I thought it might be the peekaboo bug but I tried some of the suggested fixes (position:relative, zoom:1) but no luck.</p> <p>When the demo page is opened the simple search div is displayed, when you click on the 'Advanced' button then the advanced panel slides down but is then hidden. If you resize the window then it is shown again. Removing the jquery() call to focus() fixes the problem.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function() { $("#btnSwitchAdvanced").click(function() { $("#simpleSearchPanel").slideUp(200, function() { $("#advSearchPanel").slideDown(500, function() { $("#txtASDescription").focus(); }); }); }); $("#btnSwitchSimple").click(function() { $("#advSearchPanel").slideUp(200, function() { $("#simpleSearchPanel").slideDown(500, function() { $("#txtSimpleSearch").focus(); }); }); }); $("#advSearchPanel").hide(); });</code></pre> <pre class="snippet-code-css lang-css prettyprint-override"><code>.criteriaRow { clear:both; } .criteriaLabel { float:left; width:200px; } </code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt; &lt;div id="searchPanel" style="background-color: #dcdcdc; margin-top: 5px;"&gt; &lt;div id="searchCriteria"&gt; &lt;div id="simpleSearchPanel"&gt; &lt;span&gt;Simple Search&lt;/span&gt; &lt;input type="text" id="txtSimpleSearch" /&gt; &lt;input type="button" id="btnSwitchAdvanced" value="Switch to Advanced" /&gt; &lt;/div&gt; &lt;div id="advSearchPanel"&gt; &lt;span&gt;Advanded Search&lt;/span&gt; &lt;div&gt; &lt;div class="criteriaRow"&gt; &lt;div class="criteriaLabel"&gt; &lt;span id="lblASDescription"&gt;Description:&lt;/span&gt; &lt;/div&gt; &lt;div class="criteriaInput"&gt; &lt;input type="text" id="txtASDescription" /&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="criteriaRow"&gt; &lt;div class="criteriaLabel"&gt; &lt;span id="lblASId"&gt;Id:&lt;/span&gt; &lt;/div&gt; &lt;div class="criteriaInput"&gt; &lt;input name="txtASId" type="text" id="txtASId" /&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div&gt; &lt;div id="criteriaActions" style="float:left;"&gt; &lt;input type="button" id="btnSwitchSimple" value="Switch To Simple" /&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;</code></pre> </div> </div> </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