Add type="button" to button element, or else it acts as though it were a submit button and submits the form it is in.