Note that there are some explanatory texts on larger screens.

plurals
  1. POJquery - siblings('label').show() doesnt work in IE7 for checkbox click but works for Dropdown change
    primarykey
    data
    text
    <p>I have a code snippet in which on click of checckbox I am hiding and showing the field and its label.</p> <p><strong>IN IE7</strong></p> <p>Though the hide() using siblings works fine, but on clicking again the checkbox, siblings(label).show() doesn't work</p> <p><strong>HTML CODE</strong> </p> <blockquote> <p><strong>UPDATE</strong></p> </blockquote> <pre><code> &lt;div class="rightcolumn" id="otherlabeldiv"&gt; &lt;p class="clearboth"&gt; &lt;label for="othermakemodel"&gt; Other Make &amp; Model&lt;/label&gt; &lt;input type="checkbox" name="othermakemodel" id="othermakemodel" value="1" class="chk" /&gt; &lt;/p&gt; &lt;/div&gt; &lt;div class="rightcolumn" id="otherdiv" style="display:none;"&gt; &lt;p class="clearboth"&gt; &lt;label for="cemake"&gt;* Make&lt;/label&gt; &lt;select name="cemake" id="cemake" class="required"&gt; &lt;option value="Please Select"&gt;--Please Select--&lt;/option&gt; &lt;option value="Other"&gt;Other&lt;/option&gt; &lt;/select&gt; &lt;/p&gt; &lt;p class="clearboth"&gt; &lt;label for="cemodel"&gt;* Model&lt;/label&gt; &lt;select name="cemodel" id="cemodel" class="required"&gt; &lt;option value=""&gt;--Please Select--&lt;/option&gt; &lt;!-- &lt;option value="Other"&gt;Other&lt;/option&gt;--&gt; &lt;/select&gt; &lt;/p&gt; &lt;/div&gt; </code></pre> <p><strong>JQUERY USED</strong></p> <pre><code> function setUpAjaxCalls(){ $('#cemake').live('change', function() { var val = $('#cemake :selected').text(); val = val.replace("(",'&amp;#040;'); val = val.replace(")",'&amp;#041;'); val = encodeURIComponent(val); if (val == 'Other'){ //alert(val); $('#othermakemodel').hide(); $('#othermakemodel').siblings('label').hide(); $('#other_hide').val('1'); $('#otherdiv').show(); $('#cemodel').hide(); $('#cemodel').siblings('label').hide(); }else{ $('#other_hide').val(''); $('#othermakemodel').show(); $('#othermakemodel').siblings('label').show(); $('#otherdiv').hide(); $('#cemodel').show(); $('#cemodel').siblings('label').show(); } }); } $(document).ready(function(){ setUpAjaxCalls(); $("#othermakemodel").click(function() { if($('#othermakemodel').is(':checked')){ $('#cemake').hide(); $('#cemake').siblings('label').hide(); $('#cemodel').hide(); $('#cemodel').siblings('label').hide(); }else{ $('#cemake').show();// THIS WORKs $('#cemake').siblings('label').show(); // THIS DOESNT WORK $('#cemodel').show();// THIS WORKs $('#cemodel').siblings('label').show();// THIS DOESNT WORK } }); }); </code></pre> <p>Please help me up for this issue.</p> <p>ABOVE IS THE UPDATED CODE in which you can see a change in value of "cemake" to "Other" hodes/show the other make/model text box with the same sibling concept which is not working for checkbox...</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.
 

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