Note that there are some explanatory texts on larger screens.

plurals
  1. POButton becomes enabled on RESET but shouldn't
    primarykey
    data
    text
    <p>I have a select list and based on that I made the button disabled unless a valid option is chosen, which works fine but if I hit the "reset" button in the form the "submit" button becomes enabled but it should be disabled still (since the first option has the value of "").</p> <p>How can I remedy this?</p> <p>Thanks</p> <p>jquery:</p> <pre><code>if ($("li#modFilterField_34 select").val() == "") { $('.search input[type="submit"]').attr('disabled','disabled'); } $("li#modFilterField_34 select").change(function(){ if ($(this).val() == "Paintings" ) { $('.search input[type="submit"]').removeAttr('disabled'); } else if ($(this).val() == "Houses" ) { $('.search input[type="submit"]').removeAttr('disabled'); } else { $('.search input[type="submit"]').attr('disabled','disabled'); } }); </code></pre> <p>html:</p> <pre><code> &lt;form id="modMtFilterForm0" name="modMtFilterForm0" method="get" action="/oljadir/index.php"&gt; &lt;ul class="modMtFilter" id="modMtFilter0"&gt; &lt;li class="mfieldtype_selectlist" id="modFilterField_34"&gt; &lt;label&gt;Choose type*:&lt;/label&gt; &lt;span class="filterinput"&gt;&lt;select class="inputbox text_area" name="cf34"&gt; &lt;option value=""&gt;&amp;nbsp;&lt;/option&gt; &lt;option value="Paintings"&gt;Paintings&lt;/option&gt; &lt;option value="Houses"&gt;Houses&lt;/option&gt; &lt;/select&gt; &lt;/span&gt;&lt;/li&gt; &lt;li class="mfieldtype_corename" id="modFilterField_1"&gt;&lt;label&gt;Name:&lt;/label&gt;&lt;span class="filterinput"&gt;&lt;input type="text" size="50" id="filter_cf1" name="link_name" class="inputbox text_area"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="mfieldtype_mcheckbox" id="modFilterField_33"&gt;&lt;label&gt;Ostalo::&lt;/label&gt;&lt;span class="filterinput"&gt;&lt;ul style="margin:0;padding:0;list-style-type:none"&gt;&lt;li&gt;&lt;input type="checkbox" id="filter_cf33_0" value="KTV" name="cf33[]"&gt;&lt;label for="filter_cf33_0"&gt;KTV&lt;/label&gt;&lt;/li&gt;&lt;li&gt;&lt;input type="checkbox" id="filter_cf33_1" value="Internet" name="cf33[]"&gt;&lt;label for="filter_cf33_1"&gt;Internet&lt;/label&gt;&lt;/li&gt;&lt;li&gt;&lt;input type="checkbox" id="filter_cf33_2" value="Prevoz" name="cf33[]"&gt;&lt;label for="filter_cf33_2"&gt;Prevoz&lt;/label&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/span&gt;&lt;/li&gt; &lt;li class="button-send"&gt;&lt;input type="submit" onclick="javascript:var cookie = document.cookie.split(';');for(var i=0;i &amp;lt; cookie.length;i++) {var c = cookie[i];while (c.charAt(0)==' '){c = c.substring(1,c.length);}var name = c.split('=')[0];if( name.substr(0,35) == 'com_mtree_mfields_searchFieldValue_'){document.cookie = name + '=;';}}" value="Search" disabled="disabled"&gt;&lt;/li&gt; &lt;button type="reset"&gt;Reset&lt;/button&gt; &lt;/ul&gt; &lt;/form&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