Question: Im building a small uml modeler with jointjs and raphael for a small project Im doing... I already draw classes by clicking on a button.

What I want to know specifically is how to get the onclick event working on jointjs classes diagrams, because when I click on the classes they do not work, also they move a little when I click on them, If I could get the onclick working I could probably get the objects clicked and draw the line on the background...

Any other ideas on how to draw the lines... maybe by dragging from one class to the other? 

Has anyone done this?

Thank you!

Answer: 
this is a sample code for jointjs 0.6, the trick is to use model-id attribute to select the object using jquery:

```
        var rect = new joint.shapes.basic.Rect({
        position: { x: 100, y: 30 },
        size: { width: 100, height: 30 },
        attrs: { rect: { fill: 'blue' }, text: { text: 'my box', fill: 'white' } }
    });

    graph.addCells([rect]);

    //here is the trick
    $("g[model-id='" +rect.id+ "']").click(function() {
        alert("x");
    });

```
I don't think you can bind events to mouseclick of diagram elements , since the mouseclick events are already bound by the joint lib itself.

But, you can definitely bind mousedown/mouseup events to simulate clicks.
You can implement connection creation by clicking on one element (putting the joint object in a temp var) and then clicking on another - invoking the 

```
var joint= element.joint(other_element,connection_type)

```

Hope it helps, let me know if you need some more.