I'm starting in Javascript, and would like my DropDownList
of a .ascx
control, when selecting an item, display its full value when hovering the mouse, like a tooltip or title.
This is my DropDown:
<asp:DropDownList CssClass="dropdown" ID="ddlDescricao
OnSelectedIndexChanged="ddlDescricao_SelectedIndexChanged"
runat="server" TabIndex="0">
I tried to do this:
<script type="text/javascript">
function addToolTip() {
var ddl = document.getElementById('<%= ddlDescricao.ClientID %>');
for (var i = 0; i < ddl.options.length; i++) {
ddl.options[i].title = ddl.options[i].text;
}
}
</script>
But it is not working.
I'm using jQuery 1.7
Thanks in advance.
- Edit 11/02/2016 08:27
I'm invoking the function by the dropdown's onmouseover.