Note that there are some explanatory texts on larger screens.

plurals
  1. PODependent dropdownlist works fine in increasing order selected in first dropdownlist but fails in decreasing order
    primarykey
    data
    text
    <p>I'm new to Jquery. I have written a dependent dropdownlist where I select a value from first dropdownlist and all the values greater than the first dropdownlist gets displayed in second dropdownlist.<br> When I select a value in first dropdownlist the below function gets called :</p> <pre><code>&lt;script&gt; function cost_change(price) { var value = price; console.log("value",value); var toKeep = jQuery('#SearchForm_max_cost_select option').filter( function( ) { return parseInt(this.value) &gt; parseInt( value); } ); console.log("to keep",toKeep); jQuery('#SearchForm_max_cost_select').html(toKeep); } &lt;/script&gt; </code></pre> <p>Now, the function works fine but problem is, For the first time I selected 3 from first dropdownlist then, in second dropdownlist values [4,5,6] were displayed. After that I selected 2 from first dropdownlist then, in second dropdownlist values [4,5,6] were displayed instead of [3,4,5,6]. The values displayed when I select numbers in increasing order in first dropdownlist works fine. But when I decrease the value in first dropdownlist less than the previously selected value there is no change. </p> <p>Is it a problem with cache or the above function has to be modified. </p> <p><strong>EDIT :</strong> variable price passed to the function cost_change is the value selected in first dropdownlist and works fine </p> <p><strong>HTML :</strong> </p> <pre><code>&lt;td width="250" bgcolor="#F1F5F6"&gt; &lt;select id="SearchForm_min_cost_select" style="display: none;"&gt; &lt;option value="0"&gt;&lt;/option&gt; &lt;option value="1"&gt;1&lt;/option&gt; &lt;option value="2"&gt;2&lt;/option&gt; &lt;option value="3"&gt;3&lt;/option&gt; &lt;option value="4"&gt;4&lt;/option&gt; &lt;option value="5"&gt;5&lt;/option&gt; &lt;option value="6"&gt;6&lt;/option&gt; &lt;/select&gt;&lt;input type="text" id="SearchForm_min_cost" name="SearchForm[min_cost]" style="width:70px" placeholder="Min Cost" class="ui-autocomplete-input ui-widget ui-widget-content ui-corner-left" autocomplete="off" role="textbox" aria-autocomplete="list" aria-haspopup="true"&gt;&lt;button type="button" tabindex="-1" title="Show All Items" id="btn" class="ui-button ui-widget ui-state-default ui-button-icon-only ui-corner-right ui-button-icon" role="button" aria-disabled="false"&gt;&lt;span class="ui-button-icon-primary ui-icon ui-icon-triangle-1-s"&gt;&lt;/span&gt;&lt;span class="ui-button-text"&gt;&amp;nbsp;&lt;/span&gt;&lt;/button&gt; &lt;select id="SearchForm_max_cost_select" style="display: none;"&gt; &lt;option value="0"&gt;&lt;/option&gt; &lt;option value="1"&gt;1&lt;/option&gt; &lt;option value="2"&gt;2&lt;/option&gt; &lt;option value="3"&gt;3&lt;/option&gt; &lt;option value="4"&gt;4&lt;/option&gt; &lt;option value="5"&gt;5&lt;/option&gt; &lt;option value="6"&gt;6&lt;/option&gt; &lt;/select&gt;&lt;input type="text" id="SearchForm_max_cost" name="SearchForm[max_cost]" style="width:70px" placeholder="Max Cost" class="ui-autocomplete-input ui-widget ui-widget-content ui-corner-left" autocomplete="off" role="textbox" aria-autocomplete="list" aria-haspopup="true"&gt;&lt;button type="button" tabindex="-1" title="Show All Items" id="btn" class="ui-button ui-widget ui-state-default ui-button-icon-only ui-corner-right ui-button-icon" role="button" aria-disabled="false"&gt;&lt;span class="ui-button-icon-primary ui-icon ui-icon-triangle-1-s"&gt;&lt;/span&gt;&lt;span class="ui-button-text"&gt;&amp;nbsp;&lt;/span&gt;&lt;/button&gt; &lt;/td&gt; </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