Click here to Skip to main content
15,883,901 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my project I have master page and sontent pages. In my master page I have 5 buttons. I want to show some text while the mouse hovers on those buttons. I tried with one button that has ID as 'Button6'. Here is the following code that should show 'Amla' when that mouse hovers on that button with button ID as 'Button6'. It is not showing 'Amla'. I have placed the div id:'amla' in body tag.

XML
<head runat="server">
<link rel="shortcut icon" type="image/x-icon" href="~/favicon (10).ico" />


<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js">
</script>
<script>
   $(document).ready(function() {
   $("#Amla").hide();
  $('#<%=Button6.ClientID %>').mouseover(function(){
  var div = $("#Amla");
  div.animate({ left: '3px', width:'74px',top:'3px', height:'33px' }, "fast");
  div.animate({ fontSize: '2em' }, "fast");
  $("#Amla").show();
  });
  $('#<%=Button6.ClientID %>').mouseleave(function() {
 var div = $("#Amla");
// div.animate({ left: '401px' }, "slow");
// div.animate({ fontSize: '1em' }, "slow");
 $("#Amla").hide();
  });
     </script>



<div id="Amla" runat="server" style="background:white; position:absolute;">Amla
Posted
Comments
Laiju k 4-Nov-14 1:13am    
give control details
S.Rajendran from Coimbatore 4-Nov-14 1:25am    
<asp:UpdatePanel ID="dd" runat="server">
<contenttemplate>

<div>
<asp:Panel ID="Panel2" runat="server" Width="158" Height="200" BackColor=ControlLightLight BorderWidth=".4" BorderStyle="Groove" BorderColor="White"
style=" margin-top:160px; margin-left:265px; border-bottom-style:groove; border-bottom-color:GrayText;
border-top-style:groove; border-top-color:Gray; border-top-width:medium; border-bottom-width:thick ">
<asp:Label ID="Label7" runat="server" Text="Category" ForeColor="Black" BackColor="ControlLightLight" style=" font-family:Verdana; font-weight:bolder; position:absolute; margin-left:35px; margin-top:16px; font-size:small ">
<br />

<%--<asp:Button ID="Button5" runat="server" Text='Herbal-Internal' Class="stylebutton" Font-Size="Small" BackColor="ControlLightLight" CausesValidation="false" OnClick="btnherbal_click" ForeColor="#666666" Style=" cursor:pointer; font-family:Verdana; font-weight:normal; margin-top:28px; margin-left:0px; " BorderStyle="None" />--%>
<asp:button id="Button5" runat="server" text="Herbal-Internal" class="stylebutton" causesvalidation="false" onclick="btnherbal_click" style=" margin-top:28px" />

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<contenttemplate>
<asp:Button ID="Button6" runat="server" Text='Famous short eats' class="stylebutton" causesvalidation="false" OnClick="btnprasiddhishorteats_click" />
bhagirathimfs 4-Nov-14 1:21am    
Can you please share the aspx(or html) code with us.

1 solution

As per your explanation I think you are using asp.net buttons in the master page. So the ID of the control will automatically changed by the asp.net(Use developer tool to see the ID.)

So better to use the class name to select the element or use ClientIDMode[^](asp.net Control(set the value to Static)).
 
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