Checkbox scraping, simple
by BrockA
HTML
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<div class="grid_8 pt5 displayInlineTable">
<div id="ListSelector" style="width:450px;float:left; padding-right:10px;">
<div id="testDiv" style="border: solid 1px; overflow: auto; width: 450px;
height: 200px; background-color: white" align="left">
<div id="divLB" class="hstmls" style="width: 600px;">
<input name="Name1" type="checkbox" id="ID1" checked="checked" title="Title1" value="Value1">
<label id="ID1_lf" for="ID1">Title1</label>
<br>
<input name="Name2" type="checkbox" id="ID2" checked="checked" title="Title2" value="Value2">
<label id="ID2_lf" for="ID2">Title2</label>
<br>
<input name="Name3" type="checkbox" id="ID3" title="Title3" value="Value3">
<label id="ID3_lf" for="ID3">Title3</label>
<br>
</div>
</div>
</div>
</div>
<br>
JavaScript
function getChkbxValues () {
var chkdItems = document.querySelectorAll (".displayInlineTable input:checked");
console.log ("Checked Items:\n--------------");
chkdItems.forEach ( (chkBox, J) => {
console.log (J, ": ", chkBox.value);
} );
}
//--- This is just handy demo code...
$("body").append ( `
<button id="myTestBtn">Recheck ChkBox values</button>
<p>See the browser console for output.</p>
` );
$("#myTestBtn").click (getChkbxValues);
getChkbxValues ();