Move a node to a certain position withou dragging

I use D3.js and i want that a node move to a certain position ( 1; 1000) after i clicked a button.

The onclick function looks like this:

  .on("click", function(d) {
        nodes[1].x = 1;
        nodes[1].y = 1000;
        nodes[1].px = 1;
        nodes[1].py = 1000;
        nodes[1].fixed = true; };

My problem is that this does not work right. Can someone help me maybe?

Thanks a lot!


Source: stackoverflow-javascript