0

I have two divisons one inside another.Now i want that on clicking inner divison the work being performed on click of outer divison is stoped .But I dont know whats problem with my code.Here is it :

$(document).ready(function() {
    $('.notification_one').click(function() {
        alert($(this).attr("id"));
        location.href = 'shownotification.jsp?notifyidd=' + $(this).attr("id");
    });

    $('.detele_notification').click(function() {
        DoRemove(event);
        alert("cross clicked" + $(this).attr("id"));
        var surity = confirm("Are you sure you want to delete this Notification? ");
        if (surity == true) {
            location.href = 'deletenotification?idss='+$(this).attr("id");
        }
    });
});


function DoRemove(e){
    if (!e) 
        var e = window.event;
    e.cancelBubble = true;
    if (e.stopPropagation) 
        e.stopPropagation();
}

Here notification_one is outer divison and detele_notification is inner one.Please help.

Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
user3522121
  • 215
  • 3
  • 10
  • 23

1 Answers1

0

You have code to stopPropagation in your DoRemove() function, but you're not including the event in the click handler dfeinition:

$('.detele_notification').click(function (e) { // Note 'e' here
    e.stopPropagation(); // stop the click bubbling here
    alert("cross clicked" + $(this).attr("id"));
    var surity = confirm("Are you sure you want to delete this Notification? ");
    if (surity == true){
        location.href = 'deletenotification?idss='+$(this).attr("id");
    }
});
Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339