Note that there are some explanatory texts on larger screens.

plurals
  1. POjquery selectors - identify each select/option value, in each Group
    primarykey
    data
    text
    <p>I want to identify (alert) each select/option value, in each Group. But I need a push...</p> <pre><code>&lt;script src="jquery.mobile/jquery.js"&gt;&lt;/script&gt; &lt;div id="groupA" class="preGroups"&gt; &lt;div id="section-A1"&gt; &lt;input name="SRPR1" type="text"&gt; &lt;select name='ACTC' id='preAction' &gt; &lt;option value='007'&gt;Stolen&lt;/option&gt; &lt;option value='008'&gt;Tampered&lt;/option&gt; &lt;/select&gt; &lt;/div&gt; &lt;div id="section-A2"&gt; &lt;input name="SRPR1" type="text"&gt; &lt;select name='ACTC' id='preAction' &gt; &lt;option value='007'&gt;Stolen&lt;/option&gt; &lt;option value='008'&gt;Tampered&lt;/option&gt; &lt;/select&gt; &lt;/div&gt; &lt;/div&gt; &lt;div id="groupB" class="preGroups"&gt; &lt;div id="section-B1"&gt; &lt;input name="SRPR1" type="text"&gt; &lt;select name='ACTC' id='preAction' &gt; &lt;option value='007'&gt;Stolen&lt;/option&gt; &lt;option value='008'&gt;Tampered&lt;/option&gt; &lt;/select&gt; &lt;/div&gt; &lt;div id="section-B2"&gt; &lt;input name="SRPR1" type="text"&gt; &lt;select name='ACTC' id='preAction' &gt; &lt;option value='007'&gt;Stolen&lt;/option&gt; &lt;option value='008'&gt;Tampered&lt;/option&gt; &lt;/select&gt; &lt;/div&gt; &lt;script&gt; $(document).ready(function() { // iterate through each group in groups groups = $('div[id^="group"]'); $.each(groups, function(key, group) { fnValidateGroup($(group)); }); // validation for reason codes in a specific Group function fnValidateGroup(currentGroup){ selects = $(currentGroup).find('select[name="ACTC"]'); $.each(selects, function(key, activity) { // show me activity seelctec in each case alert($(activity).val) ; }); } }); &lt;/script&gt; </code></pre> <p>*<em>edit *</em> output should look like:</p> <pre><code>new Group 007 008 new Group 007 007 </code></pre> <p>*<em>edit *</em> Here is the answer I came to with your help...</p> <pre><code>$(document).ready(function() { // iterate through each group in groups groups = $('div[id^="group"]'); $.each(groups, function() { console.log("New Group"); fnValidateGroup(this); }); // validation for reason codes in a specific Group function fnValidateGroup(currentGroup){ selects = $(currentGroup).find('select[name="ACTC"]'); $.each(selects, function(key, activity) { // show me activity seelctec in each case console.log(($(activity)).val()); }); } }); </code></pre>
    singulars
    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