Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing JQuery to select some sibling elements
    text
    copied!<p>I'm new to jquery and trying to accomplish something. My HTML looks like:</p> <pre><code>&lt;li&gt; &lt;div class="yes"&gt;&lt;input type="radio" name="Group 1"&gt;&lt;/div&gt; &lt;div class="no"&gt;&lt;input type="radio" name="Group 1"&gt;&lt;/div&gt; Group 1 &lt;ul&gt; &lt;li style="padding-left:25px"&gt; &lt;div class="yes"&gt;&lt;input type="radio" name="Item 1"&gt;&lt;/div&gt; &lt;div class="no"&gt;&lt;input type="radio" name="Item 1"&gt;&lt;/div&gt; Item 1 &lt;/li&gt; &lt;li style="padding-left:25px"&gt; &lt;div class="yes"&gt;&lt;input type="radio" name="Item 2"&gt;&lt;/div&gt; &lt;div class="no"&gt;&lt;input type="radio" name="Item 2"&gt;&lt;/div&gt; Item 2 &lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li&gt; &lt;div class="yes"&gt;&lt;input type="radio" name="Group 2"&gt;&lt;/div&gt; &lt;div class="no"&gt;&lt;input type="radio" name="Group 2"&gt;&lt;/div&gt; Group 2 &lt;ul&gt; &lt;li style="padding-left:25px"&gt; &lt;div class="yes"&gt;&lt;input type="radio" name="Item 3"&gt;&lt;/div&gt; &lt;div class="no"&gt;&lt;input type="radio" name="Item 3"&gt;&lt;/div&gt; Item 3 &lt;/li&gt; &lt;li style="padding-left:25px"&gt; &lt;div class="yes"&gt;&lt;input type="radio" name="Item 4"&gt;&lt;/div&gt; &lt;div class="no"&gt;&lt;input type="radio" name="Item 4"&gt;&lt;/div&gt; Item 4 &lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; </code></pre> <p>It took a while to get the html right (I need the divs around the radio buttons for appearances), and now I'm moving on to the JQuery processing. Primarily, I need to propagate changes to Group 1 to all of its "child" items. I'm not really sure how to accomplish that using jquery (we use 1.1.3.1).</p> <p>Any tips?</p> <p>UPDATE: I edited the HTML as suggested, cordoning off the groups.</p>
 

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