Fire onmouseover event when element is disabled

后端 未结 6 994
陌清茗
陌清茗 2020-12-09 18:24

I have some controls that I need to disable when users don\'t have edit priveleges, but are sometimes not wide enough to show the entire text of the selected option element.

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-09 18:45

    Why can't you add a title on the target element? title looks like the same as tool tip. And title works on disabled elements.

    when you set the value of your select, also set title:

    element.value=value;
    element.title = element.options[element.selectedIndex].text;
    

提交回复
热议问题