Question: I have found this:
[jQuery - Increase the value of a counter when a button is clicked](https://stackoverflow.com/questions/4701349/jquery-increase-the-value-of-a-counter-when-a-button-is-clicked) and this [JQuery Mouse Click counter](https://stackoverflow.com/questions/12319598/jquery-mouse-click-counter)

but does not work by me, i have tried this:

```
$("#btnplus").click(function(){
count =count +1;
$("#counterbox").html(count);
});

```

I have here a button and input box, button has id "btnplus" and input field "counterbox", i want if i clic on button to increase value of input, always +1, i don't get any error, what is here wrong?

Answer: 
Try this 

```
var count;

$("#btnplus").click(function(){
count =count +1;
$("#counterbox").html(count);
});

```

i think this should be work.
```
var count = 0;
$("#btnplus").click(function () {
count = count + 1;
$("#counterbox").val(count);
});

```