Display message if certain value returned

Hi guys

I am looking to return a pop up box if a certain value from my select box is picked



                var inpObjs = document.getElementsByName('typeofbike[]');        
            validChars=/^[a-zA-Z\\d]{16}$/;
                for(i=0; i < inpObjs.length; i++){
                   if (typeofbike== 'I will be using my own bike')
                       alert("If using your own scooter / bike for training, it must be of a road worthy condition, to our instructors satisfaction. Please also bring with you your current CBT certificate, a valid certificate of insurance, MOT (if applicable), and also ensure the vehicle is displaying a valid tax disc and two legally sized ‘L’ Plates");
                       return false;
                    }
                }
            

Could you guide me as to where I am going wrong

Thanks in advance

Chris

Question, did you actually get a collection when you do

var inpObjs = document.getElementsByName('typeofbike[]')

My question is, in the HTML code object should have the name typeofbike[] including the [] sings whitout numbers inside. I mean, it’s strange. Can you post the HTML to see what we are tallking about?

By the way, geting objects by name do not get you a colection of options that is probably what are you triyng to do casue you mentioned a “select” object.

See you :cool:

Hi

Yes it is checking a array and not just a single value

I hope this helps :slight_smile: