Saturday, 15 June 2013

asp.net jquery button click prevent postback -



asp.net jquery button click prevent postback -

i have asp:button , when click it, dont want postback add together new div . here code

<script type="text/javascript"> $(document).ready(function (e) { $('#<%=btn_comment_add.clientid %>').click(function (e) { $('#comments').append('<div>asd</div>'); homecoming false; }); }); </script>

here asp.net button

<asp:button id="btn_comment_add" runat="server" text="gönder" cssclass="theme04" usesubmitbehavior="false" />

i can see code adds div postbacks gets deleted. see new div sec only:)

please help me prepare wont postback. give thanks much people

instead of using asp button utilize simple html button , assign jquery function wish run,

<input type="button" name="btnname" onclick="myjueryfunction()" />

and write jquery as

function myjueryfunction() { $('#comments').append('<div>asd</div>'); }

jquery asp.net postback

No comments:

Post a Comment