Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery manipulating DIV but not its child elements
    text
    copied!<p>This is my layout:</p> <pre><code> &lt;div id="outerwrap"&gt; &lt;div id="innerwrap"&gt; &lt;div id="centerc"&gt;...&lt;/div&gt; &lt;div id="rightc" style="font-weight:bold"&gt; &lt;/div&gt; &lt;div style="background-color:White;height:10px;top:284px;left:0px"&gt;&lt;/div&gt; &lt;div id="leftc"&gt;..&lt;/div&gt; &lt;/div&gt; &lt;div id="footer""&gt;...&lt;/div&gt; #outerwrap { background-color: #EE44E7; } #innerwrap { background-color: #EE44E7; margin-right: 200px; top:0px; height:100%; } #leftc { position: absolute; top: 111px; left: 0px; width: 197px; background-color: #EE44E7; font-size: 10px; } #centerc { position: relative; margin-left: 199px; padding: 0px; background-color: white; } #rightc { position: absolute; top:111px; right: 0px; width: 199px; color: blue; background-color: #EE44E7; font-size: 10px; } #footer { padding: 0px; margin: 0px; width: 100%; height: 62px; visibility: hidden; } </code></pre> <p>This is the query I wrote:</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function() { $("#leftc").hover( function mouseover() { $(this).css({ width: "190px" }); $("#centerc").css({ "margin-left": "195px" }); }, function mouseout() { $(this).css({ width: "25px" }); $("#centerc").css({ "margin-left": "29px" }); } ); }); &lt;/script&gt; </code></pre> <p>What I want is that when the page loads, the left div should only be partially visible. Now when the user hovers the mouse, the left div(leftc) should expand to 190px. On Hover out, it should return to the partially visible state.</p> <p>The issue is that the leftc div also has some images and textbox inside it which do not get affected by the code shown above. They remain the same width?</p> <p>The controls inside the div (leftc) look similar to the following:</p> <pre><code>&lt;div id="leftc"&gt; &lt;!-- Google Search Box Start --&gt; &lt;div id="searchBox"&gt; &lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt; &lt;tr&gt;&lt;td&gt; &lt;input name="ctl00$q" type="text" value="Google Custom Search" maxlength="100" id="ctl00_q" onclick="ctl00$q.value=''" onfocus="this.className = 'highlight';" onblur="this.className = '';" style="border-color:#94C7EF;border-width:1px;border-style:solid;" /&gt;&lt;/td&gt; &lt;td align="right"&gt; &lt;input type="image" name="ctl00$_btnSearch" id="ctl00__btnSearch" src="images/search.gif" alt="Search" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&amp;quot;ctl00$_btnSearch&amp;quot;, &amp;quot;&amp;quot;, true, &amp;quot;SearchGroup&amp;quot;, &amp;quot;&amp;quot;, false, false))" style="border-width:0px;" /&gt; &lt;/td&gt; &lt;td width="5px" align="right"&gt; &lt;span id="ctl00__rfvQ" style="color:Red;visibility:hidden;"&gt;&lt;/span&gt; &lt;input type="hidden" name="ctl00$cx" id="ctl00_cx" value="004354355454353138:kmy_68iupnm" /&gt; &lt;input type="hidden" name="ctl00$cof" id="ctl00_cof" value="FORID:11" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/div&gt; &lt;!-- Google Search Box End --&gt; &lt;br /&gt;&lt;br /&gt; &lt;div id="monthlabel"&gt;All this Month&lt;/div&gt; &lt;div id="monthall"&gt; &lt;img id="ctl00_imgAuth" src="images/all/Jacor.jpg" style="border-width:0px;" /&gt;&lt;br /&gt; &lt;div style="margin-top:2px;"&gt;&lt;a href="http://www.xyz.com/AllMonth.aspx"&gt;Jacor Jul&lt;/a&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre>
 

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