-1

I have added

$( "#target" ).toggle(function() {
    alert( "First handler for .toggle() called." );
    console.log("HIiiiiiiiiiii");
}, function() {
 alert( "Second handler for .toggle() called." );
 console.log("Helooooo");
});

In Html i have added.

<div class="calendarcell"><a href="" id="target" >'+ val.Title + '</a></div>

Can u please suggest Me

Theolodis
  • 4,977
  • 3
  • 34
  • 53
Abhishek
  • 53
  • 1
  • 1
  • 8

2 Answers2

0

as toggle for function is deprecated. You can use something like this:

 $( "#target" ).click(function() {
    var isclicked= $(this).data('isclicked');
     if(isclicked){
         funct1();
     }else{
         funct2();
     }
     $(this).data("isclicked", !isclicked);
 });

working demo

Milind Anantwar
  • 81,290
  • 25
  • 94
  • 125
0

Try setting the data attribute for checking the event,

$('#target').live('click', function() {
    if ( $(this).data('flag') ) {
        console.log("HIiiiiiiiiiii");
    }else{
        console.log("Helooooo");   
    }

    $(this).data('flag', !$(this).data('flag'));
});
VPK
  • 3,010
  • 1
  • 28
  • 35