I am using jquery fullcalendar with ASP.NET MVC.

I have implemented successfully but I want to display a hyperlink after calendar load on each day.

I have set the link as well but I got a problem when I click on it because I have also done the dayClick event as well so when I click on the link that click fire dayclick event not the hyperlink.

I want to open new tab on click of that link not the dayclick event.

How should I do this?

Anyone if done help me with this problem.

Thanks in advance.

Here is a Code sample:

enter image description here

1

There are 1 answers

8
Anupam On BEST ANSWER

As per your updated post and comments following should work

$(document).on('click','.schedulelink',function(e){
   e.stopPropagation();
});

DEMO

This will prevent click event on your link to bubble up to its parents.

Read more about stopPropagation() here

Note: I have added document in selector as example, replace with appropriate parent, read more about on()

DEMO .In this demo clicking in box will show alert but clicking on link will open new tab

EDIT: Since this is not working in your environment(for some reason which you need to figure out), here is an alternate approach. check for the target element in your dayClick handler and based on that perform action.

dayClick: function(date, allDay, jsEvent, view) { 
  if (!$(jsEvent.target).hasClass('schedulelink')) { 
    //do your task
  } 
}

DEMO