Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery selectmenu - multiple menus, reset value of others when one is changed?
    primarykey
    data
    text
    <p>I am using the selectmenu plugin to style up some select menus on my site. I am using them for a filtering feature on my site. I want the user to only be able to filter by one menu at a time. So when a user selects an option on one menu the value on the other menu needs to go back to the default option.</p> <p>I have a jsfiddle set up of what I'm trying to accomplish. It is almost working. I can get other menu to reset its value back to the first value in the list of options. The problem is the one I am changing does not change, it just stays at its default value.</p> <p>Hopefully I've explained this well enough. Here's the link to the jsfiddle....</p> <p><a href="http://jsfiddle.net/dmcgrew/FBzFL/" rel="nofollow">http://jsfiddle.net/dmcgrew/FBzFL/</a></p> <p>Here's my code:</p> <pre><code>&lt;select name="type" id="type"&gt; &lt;option value="*" selected="selected"&gt;Select Project Type&lt;/option&gt; &lt;option value=".annualreport"&gt;Annual Report&lt;/option&gt; &lt;option value=".branding"&gt;Branding&lt;/option&gt; &lt;option value=".brochures"&gt;Brochures&lt;/option&gt; &lt;option value=".retail-signage"&gt;Retail Signage&lt;/option&gt; &lt;option value=".video"&gt;Video&lt;/option&gt; &lt;option value=".web"&gt;Web Development&lt;/option&gt; &lt;/select&gt; &lt;select name="industry" id="industry"&gt; &lt;option value="*" selected="selected" class="default"&gt;Select Project Industry&lt;/option&gt; &lt;option value=".consumergoods"&gt;Consumer Goods&lt;/option&gt; &lt;option value=".education"&gt;Education&lt;/option&gt; &lt;option value=".entertainment"&gt;Entertainment&lt;/option&gt; &lt;option value=".food"&gt;Food&lt;/option&gt; &lt;option value=".healthcare"&gt;Healthcare&lt;/option&gt; &lt;/select&gt; $(function(){ $('select').selectmenu({ menuWidth: 170, width: 170, maxHeight: 600 }); $('select#type').change(function(){ $("select#industry").selectmenu("index", 0); }); $('select#industry').change(function(){ $("select#type").selectmenu("index", 0); }); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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