I have two buttons with alert functions assigned to each. I want the function on the first button to only work when that button is clicked, and not work if the second button has been clicked. Below is the code I've tried, but it's not functioning as expected:
<script>
function abc(){
alert("This is an alert!");
}
function xyz(){
var a = 150;
alert(a);
}
<body>
<input type="button" value="Submit 1" onClick="abc();">
<input type="button" value="Submit 2" onClick="xyz();">
</body>