How can I get the total number of data attributes with names in HTML using JavaScript or jQuery? Then, how can I get the data attributes list? Below is my HTML page.
<body>
<form id="form1" >
<div id="divid">
<button onclick="compare();">Compare</button><br />
<table border="1">
<tr>
<td><h4>Title</h4><div style="border: 1px solid black;" data-pccompare="t2">fgfgg</div></td>
</tr>
<tr>
<td><h4>Page Name</h4><div style="border: 1px solid black;" data-pccompare="p1">fgfgg</div></td>
<td><h4>Page Name</h4><div style="border: 1px solid black;" data-pccompare="p2">fgfgg</div></td>
</tr>
<tr>
<td><h4>Description</h4><div style="border: 1px solid black;" data-pccompare="d1">fgfgg</div></td>
<td><h4>Description</h4><div style="border: 1px solid black;" data-pccompare="d2">fgfgg</div></td>
</tr>
<tr>
<td><h4>Guide Name</h4><div style="border: 1px solid black;" data-pccompare="g1">fgfgg</div></td>
<td><h4>Guide Name</h4><div style="border: 1px solid black;" data-pccompare="g2">fgfgg</div></td>
</tr>
</table>
</div>
</form>
</body>