Related Article:Return blank input field with a value help
is a solved Web Development discussion thread by double_cola that has 1 reply, was last updated 6 months ago and has been tagged with the keywords: input, field, php, drag, and, drop, pdf.
when page reloads, everything in javascript resets, So I advised you to store last number in cookie and increment and display that cookie value on every page load
Here's an online example in JSFiddle: JSFiddle Example
I've set the onDomReady on js fiddle. Here's a sample on firing the snippet when the page finishes loading. There are many flavors on firing this up, like checking the document readystate and so on and so for. But hopefully, this explains it.
window.onload = function(){
var form = document.getElementById("myForm"),
incInput = form["formitemquantity[]"],
len = incInput.length,
ctr = 0;
for(;ctr < len; ctr++){
incInput[ctr].value = ctr;
}
};