You can access that div through the canvas property of the Connection’s Endpoints:
var c = myInstance.connect({...});
c.endpoints[0].canvas.setAttribute("title", "whatever");
Do not override the ID attribute…that would confuse jsPlumb.
I didn’t know that the title attribute is not supported in SVG elements (or at least, it’s at the discretion of the browser vendor)…but it doesn’t surprise me I guess.
I typically use a hidden label with mouseover/mouseout events for this:
jsPlumb.connect({
source:"chartWindow1",
target:"chartWindow2",
overlays:[
[ "Label", {label:"FOO", id:"label", visible:false } ]
],
events:{
mouseover:function(c) { c.showOverlay("label"); },
mouseout:function(c) { c.hideOverlay("label"); }
}
});
which you could of course generalise to a function:
var _hoverConnect = function(source, target, label) {
jsPlumb.connect({
source:source,
target:target,
overlays:[
[ "Label", {label:label, id:"label", visible:false } ]
],
events:{
mouseover:function(c) { c.showOverlay("label"); },
mouseout:function(c) { c.hideOverlay("label"); }
}
});
};
I suppose, looking at this now, it wouldn’t be a big stretch to put a flag in an overlay spec like hover that basically said “show me only when the user is hovering on the connection”. Because the setup I have above works when you’re using connect, but if the user is establishing connections with the mouse you’d have to do a similar thing via event callbacks.
These are the Connection events to which you can bind a listener:
click(connection, originalEvent) - notification a Connection was clicked.
dblclick(connection, originalEvent) - notification a Connection was double-clicked.
contextmenu(connection, originalEvent) - a right-click on the Connection.
mouseenter(connection, originalEvent) - notification the mouse entered the Connection's path.
mouseleave(connection, originalEvent) - notification the mouse exited the Connection's path.
mousedown(connection, originalEvent) - notification the mouse button was pressed on the Connection's path.
mouseup(connection, originalEvent) - notification the mouse button was released on the Connection's path.