1

In my html page i have drop-down list box.
I need to add onmouseover event dynamically via javascript for all option tag under my select tag. I'm using prototype.js
how to do this?

<select id="dash_key" name="dash_key">
    <option value="cginterval">Hosts and Applications</option>
    <option value="vsat">VSAT</option>
    <option value="LinkLayer">Link Layer Activity</option>
    <option value="protocols ">Protocols and Hosts</option>
    <option value="subnets">Hosts and Subnets</option>
    <option value="Netflow">Netflow Sources</option>
</select>
6
  • Please add some code, so we know what IDs, classes etc. we can use. Have you tried anything yourself, yet? Commented Nov 14, 2011 at 11:50
  • <select id="dash_key" name="dash_key"> <option value="cginterval">Hosts and Applications</option> <option value="vsat">VSAT</option> <option value="LinkLayer">Link Layer Activity</option> <option value="protocols ">Protocols and Hosts</option> </select> Commented Nov 14, 2011 at 11:52
  • Can you explain what you want to achieve with separate events? I'm thinking if onchange on the select might be an alternative. Commented Nov 14, 2011 at 11:56
  • i need to add tooltip on mouseover event. Commented Nov 14, 2011 at 11:58
  • 1
    May title="Tooltip text" be enough? -- jsfiddle.net/D6zqc Commented Nov 14, 2011 at 12:02

1 Answer 1

2

Use the observe method.

Event.observe(element, "mouseover", handler) 

… but note that browser support for mouseover events on option elements is probably very limited.

Sign up to request clarification or add additional context in comments.

1 Comment

Why don't you try? And yes, I think so.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.