jeudi 21 juillet 2016

Function passed not firing on click event

I have a button ("#button-delete") in a Bootstrap popover. When clicked, I need the function deleteResult() to be fired. I can see that the click event is working, since I am making it change the background-color of an element on my page. But the deleteResult() function is not firing...

$('body').on('click', '.popover #button-delete', function() {
    $("#output").css('background-color', 'blue');
    deleteResult();
});

function deleteResult() {
    $("#output").css('background-color', 'red');
    //other stuff here
}

When my button is clicked, the #output element becomes blue, and not red... Why is the function not firing?

Thanks!

Aucun commentaire:

Enregistrer un commentaire