Changed selector for getting $clickedElement. When a button was in another tag, instead of being directly below the form tag, the otehr tag would get set as the clicked element.