Phanindra Kumar
Phanindra Kumar

Reputation: 169

confirm box jquery

I'm using Predefined jquery css form Template.

<asp:Button ID="btndeleteselected" runat="server" Text="Delete" 
     CssClass="basicBtn mr10 ml10 bConfirm"  OnClick="btndeleteselected_Click"  />

When I click on button I need to dispaly confirm box to delete. But when I clicked on button

event is firing without getting confirm box . What do I need to do?

my jquery function is

$(".bConfirm").click( function() {
    jConfirm('Can you confirm this?', 'Confirmation Dialog', function(r) {
        jAlert('Confirmed: ' + r, 'Confirmation Results');
    });
});

It is defiend in custom.js predefined jquery files

Upvotes: 1

Views: 691

Answers (1)

Jamiec
Jamiec

Reputation: 136074

You need to tell the click event not to process, by calling preventDefault() on the event passed to the click handler:

$(".bConfirm").click( function(e) {
    jConfirm('Can you confirm this?', 'Confirmation Dialog', function(r) {
        jAlert('Confirmed: ' + r, 'Confirmation Results');
    });
    e.preventDefault();
    return false
});

Upvotes: 2

Related Questions