Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have some controls that I need to disable when users don't have edit privileges, but are sometimes not wide enough to show the entire text of the selected option element. In which case I've added a tool tip with ASP.NET and the following code

ddl.Attributes.Add("onmouseover", "this.title=this.options[this.selectedIndex].title")

This works when the control is enabled, but doesn't work when it is disabled.

The following alert will not fire when a mouse is over the select element:

<select disabled="disabled" onmouseover="alert('hi');">
    <option>Disabled</option>
</select>

See this fiddle.

Q: Can I fire the onmouseover event for controls that are disabled?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
737 views
Welcome To Ask or Share your Answers For Others

1 Answer

Disabled elements do not fire events, e.g. users cannot hover or click them to trigger a popover (or tooltip). You can however wrap the disabled element with a DIV and listen to the event fired on that element instead.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...