I have two buttons that call the same function. The btnUpdate button needs to execute this function, while the btnSave button does not need to execute it.
<script type="text/javascript>
function Update_New() {
if (document.getElementById("btnUpdate").value == 2) {
var update_confrimation = confirm("Are you sure you want to Update?");
if (update_confrimation == true) {
return true;
} else {
return false;
}
}
CODE FOR BUTTONS
<asp:Button ID="btnSave" runat="server" Text="SAVE" OnClick="btnSave_Click" OnClientClick="return Update_New()" value="1" />
<asp:Button ID="btnUpdate" runat="server" Text="UPDATE" OnClick="btnUpdate_Click" OnClientClick="return Update_New() " value="2" /
WHEN I CLICK UPDATE, NO ACTION TAKES PLACE The problem is that VALUE IS NOT DEFINED in JavaScript (@document.getElementById(“btnUpdate”).value)