5

I´ve got 3 select boxes:

<div class="widget mm_select"> <label for="ctrl_Customers_Region">Region</label> <select name="Customers_Region" id="ctrl_Customers_Region" class="select"><option value="">No filtering</option><option value="emea" selected="">EMEA</option><option value="america">America</option><option value="apac">APAC</option><option value="global">Global</option></select></div> <div class="widget mm_select "> <label for="ctrl_Customers_Branche">Business</label> <select name="Customers_Branche" id="ctrl_Customers_Branche" class="select"><option value="">No filtering</option><option value="retail-fashion">Retail - Fashion</option><option value="retail-consumer-electronics">Retail - Consumer Electronics</option><option value="retail-digital-goods">Retail - Digital Goods</option><option value="retail-furniture">Retail - Furniture</option><option value="retail-other">Retail - Other</option><option value="manufacturing-automotive">Manufacturing - Automotive</option><option value="manufacturing-pharmaceuticals-chemicals">Manufacturing - Pharmaceuticals / Chemicals</option><option value="manufacturing-high-tech">Manufacturing - High-Tech</option><option value="manufacturing-other">Manufacturing - Other</option><option value="utilities-and-telco-utilities">Utilities and Telco - Utilities</option><option value="utilities-and-telco-telco">Utilities and Telco - Telco</option><option value="food-grocery-and-equipment">Food - Grocery and Equipment</option><option value="media-entertainment-and-publishing">Media, Entertainment, and Publishing</option><option value="b2b-and-distribution">B2B and Distribution</option></select></div> 

How can I check, if any of the 3 select boxes is selected?

Thx

1
  • 1
    $('select').is(':has(option[value!=""]:selected)') Commented Apr 27, 2015 at 13:12

1 Answer 1

2

You can find the option that are selected and not having value "":

 if($('select option:selected[value!=""]').length ) { //more than one select box is selected } 
Sign up to request clarification or add additional context in comments.

4 Comments

Thanks, does this script works for all 3 select boxes?
the selector is global. so yes.
Cool, I ´ve tried this, but it doesnt work in Firefox: if($('select option:selected[value!=""]').length ) { $('body').animate({ scrollTop: parseInt($(".ce_metamodels_frontendfilter").offset().top -320) }, 2000); }
can you create the fiddle for same??

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.