Click here to Skip to main content
15,910,981 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to add tooltip text with dropdownlist text on dropdownlist mouseover event.
I have created it.But is show old value every time.
I am using mvc4,html5 and knockout.js

self.showTooltip = function () {
var tooltip = document.getElementById('SelectTooltip');
tooltip.innerHTML = $("#timezone").children(":selected").text()//$("#timezone").find(":selected").each(function();
tooltip.style.display = 'block';
}
Posted

1 solution

Use this code


XML
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default6.aspx.cs" Inherits="Default6" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

    <script type="text/javascript" src="Script/jquery-1.7.2.min.js"></script>

    <script language="javascript" type="text/javascript">
        $(document).ready(function() {
            $('#DropDownList1 option').each(function() {
                $(this).attr('title', 'tooltip msg:- ' + $(this).text());
            });
        });

    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:DropDownList ID="DropDownList1" runat="server">
            <asp:ListItem Text="Val1" Value="1"></asp:ListItem>
            <asp:ListItem Text="Val2" Value="2"></asp:ListItem>
            <asp:ListItem Text="Val3" Value="3"></asp:ListItem>
            <asp:ListItem Text="Val4" Value="4"></asp:ListItem>
        </asp:DropDownList>
    </div>
    </form>
</body>
</html>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900