简体   繁体   中英

javascript fullcalendar plus bootstrap tooltips

I am trying to attach a bootstrap tooltip to a particular fullcalendar day-view td element. I can get the td element from the FC click event on that element. If I do a console.dir(thing); then the element comes back as an object that (in chrome's js console) looks like:

i.fn.init(1)
    # 0: td.ui-widget-content
      length: 1
    # __proto__: Object(0)

The # s imply sub-objects. Ok, what I want is the "text" value of that "0" object key... I want to get the string "td.ui-widget-content".

I've tried the following:

console.dir(thing);
console.dir(thing[0]);
console.log(Object.keys(thing));
console.log(Object.keys(thing[0]));

The first yeilds the object above. The second prints

# td.ui-widget-content

Again, the # implies a sub-object. The third prints

# (2) ["0", "length"]

and the last prints

# []

If I do console.log(thing[0]) the reault is the outter html of the DOM element.

How do I get that "td.ui-widget-content" string from the object?

this will be a jquery object during the "dayClick" event.

Bootstrap tooltips, as I understand them from https://getbootstrap.com/docs/4.0/components/tooltips/ can be attached to jQuery objects.

Therefore

dayClick: function(date, jsEvent, view) {
  this.tooltip({ title: "Hi" });
}

should do what you need, I think.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM