user1880192
user1880192

Reputation: 51

jQuery Fullcalendar event title click

I am trying to create a title with a delete button and it works well for me. How would I differentiate the event click? Meaning the user clicks on the delete button or the user click on the event itself?

Upvotes: 0

Views: 1462

Answers (1)

Sudhir Bastakoti
Sudhir Bastakoti

Reputation: 100175

One option would be, add a unique class to the delete button, and use fullCalendar's eventClick() function. It has second parameter jsEvent which holds the native javascript event. Using this jsEvent you could check the target class , say you've added delete_btn as the class of delete button, then do:

..
eventClick: function (calEvent, jsEvent, view) {
    var $element = $(jsEvent.target);
    if( $element.hasClass("delete_btn") ) {
        //you clicked delete button
    }
    else {
        //you clicked elsewhere in the event block
    }
},
..

Note that this is not tested.

Upvotes: 1

Related Questions