I would like to have asp:Button and when I click it, I dont want it to do postback but add a new div into . here is my code
<script type="text/javascript">
$(document).ready(function (e) {
$('#<%=btn_comment_add.ClientID %>').click(function (e) {
$('#comments').append('<div>asd</div>');
return false;
});
});
</script>
here is the asp.net button
<asp:Button ID="btn_comment_add" runat="server" Text="Gönder" CssClass="theme04" UseSubmitBehavior="false" />
I can see that code adds the div but it postbacks so it gets deleted. I see the new div for a second only:)
please help me to fix it so it wont postback. Thank you very much people
instead of using ASP Button use simple HTML button and assign jquery function that you wish to run,
<input type="button" name="btnname" onclick="MyJueryFunction()" />
and write you jquery as
function MyJueryFunction()
{
$('#comments').append('<div>asd</div>');
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With