I have a button in my JSP,
<input type="button" id="processItem" name="_eventId_submitButton" value="Submit" onclick="submitClick();buttonClick();"></input>
my javascript,
var clicks = 0;
function submitClick(){
var aButton = document.getElementById('submithidden');
aButton.click();
return true;
}
function buttonClick(){
document.getElementById('clicked').value = ++clicks;
}
this is where I am showing the counts of submit
<tr><td><p>Total No of Scans<input type="text" id="clicked" size="3"
onfocus="this.blur();" value="0" >.</p></td></tr>
everytime I click on submit, counter shows 1 and immediately the page refreshes and again it becomes 0. I want to keep it incremented untill the user leaves the page!
Try this
False instead of true 😉
the button “posts” the site, if you set false, i will not fire