Search code examples
c#javascriptjqueryasp.netqtip

asp.net make function from jquery code


I am using Qtip jquery plugin for my tooltips and because I have many items that need this I do not want to manually do it for each, bad coding anyway.

This is the JS code:

$('#<%= textlink.ClientID %>').qtip({               
    position: { 
          corner: {
                      target: 'topRight', 
                      tooltip: 'bottomLeft'
            }
              },                                    
        style:{ 
            name: 'dark',
            tip: 'bottomLeft',
            border:
              {
            width: 3,
            radius: 7
        }
    } 
});

and

<asp:LinkButton ID="textlink" runat="server" Text="some text" ToolTip="some other text"></asp:LinkButton>

I will have many linkbutton objects, so how can I create a function from the JS code above and call it on mouse over of the linkbutton action?


Solution

  • Do this:

    <asp:LinkButton cssClass="qTip" ID="textlink" runat="server" Text="some text" ToolTip="some other text"></asp:LinkButton>
    
    $('.qTip').qtip({               
        position: { 
              corner: {
                          target: 'topRight', 
                          tooltip: 'bottomLeft'
                }
                  },                                    
            style:{ 
                name: 'dark',
                tip: 'bottomLeft',
                border:
                  {
                width: 3,
                radius: 7
            }
        } 
    });