Is there anyone who can help me with this. I am playing arround with one small button project.
I am using css button but lets say an button from here. “example: http://www.cssbuttongenerator.com/“
Now lets say, when someone click on the button it will write below the button 1…
If someone click again it will write 2… No matter who will click. Me, you or someone third. It will count and remember number of clicked times.
Now lets say it counts to 100, so 100 persons can click on it. After that it resets to 0 and start counting clicks again.
It must be possible. Jquery or whatever is required, please help this newb (me).
Even use an input button or an image or whatever… Just to count and remember clicks. Thank you , awaiting for some great answers!
you can make use of cookies set them using javascript and on button click read the value of that cookie
for more information on manipulating cookies using javascript please go through this.
Here is also an other link that explains how to store the value in cookies using javascript
UPDATE
your solution is possible without cookies too if you don’t want to persist the counter between different request to the page and for a single user
i made a fiddle please see here
i hope it will help
UPDATE 2
your
This is only possible when you are working with any server side technology like asp.net,Java/jsp/PHP because the cookie based solution will not fit your need in that case .if you wish that anyone click and every time is should incereament the counter no matter who clicked it then you have to USE server side Sessions.
UPDATE
in jquery onDOMReady meand when the document/page loads completely then only the scripts will run so its error safe way of registering the script with the page
anyways
I used jquery styled click handlers for buttons if you are not using jquery then you can simple call count function on button onclick event
if you are using jquery then you can write it like this