When the page loads, I get the message box saying “testing” even before I click on the button. Is this functionality normal? I have also tried .click and .on with the same results.
<script type="text/javascript">
function Update() {
alert("testing");
}
$(document).ready(function () {
$("#UpdateButton").bind(Update())
});
</script>
You aren’t binding the function. You’re calling the function and then binding the output of the function. Try clicking on your button and see if the event fires.
Instead, bind the function iteself (notice the lack of parentheses:
()):Or: