jsPlumb - adding a string value to an edge

253 views Asked by At

I am making a webapp using jQuery jsPlumb. I am interested in prompting the user to insert a value whenever the drag-and-drop a new edge. However, I am unsure how to do this.

Would anyone be able to help?

jsPlumb - http://www.jsplumb.org/demo/flowchart/dom.html

Thanks!

1

There are 1 answers

0
Pratik On BEST ANSWER

If by "drag-and-drop a new edge" you mean making a connection then you can use the connection event.

 jsPlumb.bind("connection", function (connInfo, originalEvent) {
     // you could ask for input here.
     var userText = prompt("Please enter your name", "Harry Potter");
     // If you want to put the text in  the overlay label on the 
      connInfo.connection.getOverlay("label").setLabel(userText);

 } );

The above code should be able to get input from the user and set it into the overlay for the connection created.