Click here to Skip to main content
15,885,669 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

Now, i have two div (CustomerInfo and userMedia):-
<div id="CustomerInfo" runat="server">
<asp:Button ID="BtnSubmit" runat="server" Text="Submit"
onclick="BtnSubmit_Click" CssClass="button"
style="position:absolute; top: 126px; left: 65px;" />



<div id="userMedia" runat="server">
<asp:Button ID="BtnStop" runat="server" Text="Stop"
onclick="BtnSubmit_Click" CssClass="button"
style="position:absolute; top: 126px; left: 65px;" />


i want to hide BtnStop on BtnSubmit click.:- like this

$(document).ready(function () {
$("#BtnSubmit").click(function () {

$("#BtnStop").hide();
//alert("button");

});
});

but this function is not running.
Please help me,
How it can be resolve.

Thanks in Advance.

Ankit Agarwal
Software Engineer
Posted
Comments
Krunal Rohit 19-Nov-15 5:24am    
remove the onclick for the BtnSubmit.

-KR
Agarwal1984 19-Nov-15 5:27am    
I cant remove because my server side coadding in this button.
which data saved in sql server database.
Krunal Rohit 19-Nov-15 5:32am    
Oops! Okay let me check the code again.
Till then put the debugger; at the very first line of the $("#BtnSubmit").click and check what's happening.

-KR

The button is being hidden but your button click is causing a postback which is causing the whole page to be refreshed which is putting the button back. Change the visibility of the button in your BtnSubmit_Click event in code-behind;

C#
BtnSubmit.Visible = false;


It could also be that the ID you are using is wrong, asp.net changes the IDs of items when they are rendered to the client.

$("#<%=BtnSubmit.ClientID%>").click(function () {

 $("#<%=BtnSubmit.ClientID%>").hide();
 
Share this answer
 
Check jquery reference and make sure tags are formed well...
Also try this,

$(document).ready(function(){
var submit = document.getElementById("#BtnSubmit");
var stop = document.getElementById("#BtnStop");
$("#BtnSubmit").click(function(){
stop.Hide();
});
});
 
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