Note that there are some explanatory texts on larger screens.

plurals
  1. POFetch input type value by ID where display is not none
    primarykey
    data
    text
    <p>I have multiple fields associated with conditional select. If Condition doesn't match others input field get associated with style (display:none) in above div ID &amp; one which match remains active, it set (display:block) in above div ID.. This is in drupal, so I don't have control over it...so here is the example which get generate--</p> <pre><code>&lt;div id="edit-field-p1brp-price" class="field-type-text field-name-field-p1brp-price field-widget-text-textfield form-wrapper" style="display: block;"&gt; &lt;div id="field-p1brp-price-add-more-wrapper"&gt; &lt;div class="form-item form-type-textfield form-item-field-p1brp-price-und-0-value"&gt; &lt;label for="edit-field-p1brp-price-und-0-value"&gt; &lt;input id="edit-field-p1brp-price-und-0-value" class="text-full form-text required" type="text" maxlength="255" size="60" value="5,98,000" name="field_p1brp_price[und][0][value]"&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div id="edit-field-sspps-price" class="field-type-text field-name-field-sspps-price field-widget-text-textfield form-wrapper" style="display: none;"&gt; &lt;div id="field-sspps-price-add-more-wrapper"&gt; &lt;div class="form-item form-type-textfield form-item-field-sspps-price-und-0-value"&gt; &lt;label for="edit-field-sspps-price-und-0-value"&gt; &lt;input id="edit-field-sspps-price-und-0-value" class="text-full form-text required" type="text" maxlength="255" size="60" value="4,65,000" name="field_sspps_price[und][0][value]"&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div id="edit-field-sspr1br-price" class="field-type-text field-name-field-sspr1br-price field-widget-text-textfield form-wrapper" style="display: none;"&gt; &lt;div id="field-sspr1br-price-add-more-wrapper"&gt; &lt;div class="form-item form-type-textfield form-item-field-sspr1br-price-und-0-value"&gt; &lt;label for="edit-field-sspr1br-price-und-0-value"&gt; &lt;input id="edit-field-sspr1br-price-und-0-value" class="text-full form-text required" type="text" maxlength="255" size="60" value="3,98,000" name="field_sspr1br_price[und][0][value]"&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>I have to fetch the value of only that input for which DISPLAY is BLOCK in above DIV. I tried with the below DIV ID with visible, but it doesn't return &amp; trying with above DIV ID and value for that also not happening(Here is the last code which I tried)--</p> <pre><code>if (($("#edit-field-p1brp-price-und-0-value:block").length &gt; 0)){ var price = $('#edit-field-p1brp-price-und-0-value').val(); } if (($("#edit-field-sspps-price-und-0-value:visible").length &gt; 0)){ var price = $('#dit-field-sspps-price-und-0-value').val(); } if (($("#edit-field-sspr1br-price-und-0-value:visible").length &gt; 0)){ var price = $('#edit-field-sspr1br-price-und-0-value').val(); } </code></pre> <p>UPDATE---</p> <p>Code update which I am using for fetch the value on the change of one select &amp; alert, but it's giving NULL only..</p> <pre><code>$(document).ready(function() { var price = null; $('div.form-item-field-membership-payment-type-und').change(function() { $("#edit-field-p1brp-price-und-0-value, #edit-field-sspps-price-und-0-value, #edit-field-sspr1br-price-und-0-value").each(function() { if($(this).is(':visible')) { price = $(this).val(); alert(price); } }); alert(price); }); }); </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.
 

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