Jump to content

Recognizing if a specific select option was chosen?


galvin

Recommended Posts

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>

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.