Added onclick event listener to trigger attack method