function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Tyler HarrisTyler Harris 

JavaScript Loop Through Picklist - Hide Options by Letter?

Hi All,

How can I hide picklist options if they contain a number?

For example hide picklist option if it contains "M"

JS
function setSSKU(){
        var SSKUE = document.getElementById('{!$Component.tktForm:SSKU}');
        var model = document.getElementById('{!$Component.tktForm:selModel}').value;
        var m = [];
        //var v = [];
        if(model=='M-Series'){
            
            for(i=0; i < SSKUE.options.length; i++){
 
                m.push(SSKUE[i]);
                //SSKUE.options[i].style.display ="none";
                console.log(m);
                }
            }
        
        if(model=='V-Series'){
            SSKUE.options[1].style.display ="none";
            SSKUE.options[2].style.display ="none";

        	
           }
            

        }

VF
<apex:outputpanel id="SSPanel" style="display: none;">    
             <div class="label" style="{!If(strLanguageCode=='ru','height:30px;','')}">
                <label for="SSKU" id='S_SKU'><span class="req">*</span>
                Sensor SKU:
              
                <!-- License Key/Serial Number -->
                </label> 
             </div>
             <div class="val" style="{!If(strLanguageCode=='ru','height:33px;','')}">
                 <apex:inputField id="SSKU" value="{!objCase.Sensor_SKU__c}"/>  
             </div>
            </apex:outputpanel>