galvin Posted April 14, 2011 Share Posted April 14, 2011 If you have a straightforward select menu like the one below, what javascript code could be used to say (in plain english).."if the option for OTHER is selected, run this function". I tried doing "onfocus" in the option value for OTHER, but it didn't work. Can anyone help? <option value="1and1">1 & 1</option> <option value="enom">eNom</option> <option value="godaddy">GoDaddy</option> <option value="namecheap">NameCheap</option> <option value="networksolutions">Network Solutions</option> <option value="register">Register.com</option> <option value="srsplus">SRS Plus</option> <option value="other">OTHER</option> Quote Link to comment Share on other sites More sharing options...
requinix Posted April 14, 2011 Share Posted April 14, 2011 Stick an onchange on the and look at its .value (assuming the user can only select one option). Quote Link to comment Share on other sites More sharing options...
nogray Posted April 14, 2011 Share Posted April 14, 2011 try this <select onchange="if (this.value == 'other') call_function();">... Quote Link to comment Share on other sites More sharing options...
Adam Posted April 14, 2011 Share Posted April 14, 2011 You should move the condition to the function... Your HTML mark-up shouldn't contain JavaScript logic -- it's actually good practise to remove all event bindings from the HTML too, never-mind this. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.