Added event for removing a reference; functionality stopped working afte...

...r wrapping in jQuery.

This is probably not the best fix possible, but it solves the problem of no longer being able to remove a reference. The onClick attribute was removed from the template and a simple event handler was added to the javascript.