add onclick handler to relevant anchors