I have a simple html page to test custom 'data' attribute that is used for HTML check boxes to hold 'id' data. However, on retrieving values of those 'id' against selected check boxes, I lost leading zeros in those data-id attribute. For example, one specific check box is defined as:
<input type="checkbox" data-id="00372" >
When I retrieve the value of its 'id', the returned value is 372 instead of 00372. Please help.
The code details of my HTML page:
<html>
<head>
    <script type="text/javascript" src="jquery-1.6.2.js"></script>
    <script type="text/javascript">
            function buttonCollectId_Click()
            {               
                $('input[type=checkbox]:checked').each(function(index,value){
                        console.log('Selected:' + $(this).data('id'));
                });
            }
    </script>
</head>
<body>
    <table>
    <tr>
       <td>Employee Id:</td><td>02813</td><td><input type="checkbox" data-id="02813" ></td>
    </tr>
    <tr>
       <td>Employee Id:</td><td>46522</td><td><input type="checkbox" data-id="46522" ></td>
    </tr>
    <tr>
       <td>Employee Id:</td><td>00372</td><td><input type="checkbox" data-id="00372" ></td>
    </tr>
    <tr>
        <td colspan="3"><input id="buttonCollectId" type="button" value="Collect Ids" onclick="buttonCollectId_Click();"></td>
    </tr>
    </table>
</body>
</html>
 
     
    