Hi all,
I have a lot of checkboxes on a form and I would like to set a unique value to their VALUE attribute. So basically what I am after is a script that parses through all <INPUT> tags of TYPE "checkbox" and sets the VALUE attribute to a unique number (I suggested that it would be incremented).
Here is an example of what I am after:
Before:
After:
Thanks in advance guys.
I have a lot of checkboxes on a form and I would like to set a unique value to their VALUE attribute. So basically what I am after is a script that parses through all <INPUT> tags of TYPE "checkbox" and sets the VALUE attribute to a unique number (I suggested that it would be incremented).
Here is an example of what I am after:
Before:
Code:
<INPUT ID="chkOption1" TYPE="checkbox" VALUE="checkbox" />
<INPUT ID="chkOption2" TYPE="checkbox" VALUE="checkbox" />
<INPUT ID="chkOption3" TYPE="checkbox" VALUE="checkbox" />
After:
Code:
<INPUT ID="chkOption1" TYPE="checkbox" VALUE="1" />
<INPUT ID="chkOption2" TYPE="checkbox" VALUE="2" />
<INPUT ID="chkOption3" TYPE="checkbox" VALUE="3" />
Thanks in advance guys.