Vis Network

Other

Popups

Both nodes and edges can have popup shown when hovered by a cursor.

It is possible to use plain text:


const nodes = [{
  id: 1,
  title: "Popup text",
}];
      

Alternatively an element can be supplied:


const element = document.createElement("div");
// Add child nodes, change styles…

const nodes = [{
  id: 1,
  title: element,
}];
      

XSS

In the past the popup was filled using innerHTML. It is still possible to achieve similar behavior via an element.


function createHTMLTitle(html) {
  var element = document.createElement("div");
  element.innerHTML = html;
  return element;
}
      

Keep in mind though that this can lead to XSS attacks: