Add onClick handler to nodes