Search code examples
javascriptjqueryjsplumb

jsPlumb - Is it possible to assign endpoints to group of element using class name?


I would like to assign same endpoint to various container. But I have to manually assign them to each container like:

jsPlumb.addEndpoint('window', { anchor:[0.5, 1, 0, 1] }, exampleEndpoint2);
jsPlumb.addEndpoint('window2', { anchor:"RightMiddle" }, exampleEndpoint2);
jsPlumb.addEndpoint("window3", { anchor:[0.75, 0, 0, -1] }, exampleEndpoint2);
jsPlumb.addEndpoint("window4", { anchor:[0.25, 0, 0, -1] }, exampleEndpoint2);

Is there a way I can assign this to a class selector like:

jsPlumb.addEndpoint(".window", { anchor:[0.25, 0, 0, -1] }, exampleEndpoint2);

Or may be a workaround?


Solution

  • You can just use a jQuery selector like this:

    jsPlumb.addEndpoint($(".window"), { anchor:[0.25, 0, 0, -1] }, exampleEndpoint2);