Here is my function i am declaring bar='0' i just want to update the value of bar='1' only if change is clicked, else the bar should have the default value as 0. so that when ever i alert the bar should alert.
i.e.,
If i click on the change the bar should have the value of 1 else it should have the default value as 0
How can i do this ..
Here is the code i have tried so far
<script>
$(function(){
var bar = "0";
$('#change').click(function()
{
var bar = "1";
});
$('#fire').click(function()
alert(bar);
}
});
</script>
id