views:

31

answers:

1

Hi I have the following codes

$('#<%= btnOpen.ClientID %>').click(function() {
            $('#content').modal();
});
 <asp:Button ID="btnOpen" runat="server" Text="Open" />

When I click on the button, the modal window will appear for about 0.5 second and disappear right away.Can anyone help me please? Thanks a lot!

+1  A: 

Try with this. I'd say that a postback is happening so with event.preventDefault() you prevent the postback.

$('#<%= btnOpen.ClientID %>').click(function(event) {
        $('#content').modal();
        event.preventDefault();
});
Claudio Redi
Thank you Claudio Redi, your answer fix the problem. However, what if I do need the postback?
well, maybe you can explain better why you would need that. If you do a postback, then you can't show the modal on click.
Claudio Redi