2

I'm using fullcalendar.js in Jquery. I have a problem to get a child element from a HTMl element.

I call https://fullcalendar.io/docs/eventClick which returns me info.

eventClick: function(info) {
           console.log(info.el);
           let $el = $.parseHTML(info.el);
           console.log($el);
           console.log(info.el.children('.tooltipster'));

So the fist console.log return me

    <a class="fc-time-grid-event fc-event fc-start fc-end fc-draggable fc-short" style="background-color: rgb(37, 126, 74); border-color: rgb(37, 126, 74); top: 356px; bottom: -382px; z-index: 1; left: 0%; right: 0%;">
      <div class="fc-content tooltipster tooltipstered" data-tooltip-content="#tooltip_content0">
         <div class="fc-time" data-start="14:00" data-full="14:00 - 14:30">
           <span>14:00 - 14:30</span>
         </div>
         <div class="fc-title">XXX</div>
      </div>
    </a>

The second one give me null

And the last One

TypeError: info.el.children is not a function

What I want to do is to access my child element with ".tooltipstered" as a class in order to get is value of 'tooltip-content' attr.

Thank you

ADyson
  • 57,178
  • 14
  • 51
  • 63
Ugo Lfe
  • 717
  • 2
  • 9
  • 27

1 Answers1

2

The solution was to cover info.el with a jQuery tag like this $(info.el)

 eventClick: function(info) {
           console.log(info.el);
           let $el = $(info.el);
           console.log($el);
           console.log($el.children('.tooltipster'));
Ugo Lfe
  • 717
  • 2
  • 9
  • 27