I'm trying to show the table row based on the user selection in the checkbox. I'm getting a error in the console. As I'm noob in JavaScript and I'm reusing this snippet from Show/Hide Table Rows based on Checkbox Any help is really appreciated.
how could possibly compare it though I need to match the database value which I don't specify explicitly like the country name all it comes from the database
error:
(index):344 Uncaught ReferenceError: show Hide is not defined
at HTMLDivElement.onclick ((index):344)
html:
<div>Country</div>
<div class="row" name="country_checkbox" id="id_row" >
<ul id="id_country">
<li><label for="id_country_0"><input type="checkbox" name="country" value="NORTHAMERICA" placeholder="Select Country" id="id_country_0">
NORTHAMERICA</label>
</li>
<li><label for="id_country_3"><input type="checkbox" name="country" value="AMERICA" placeholder="Select Country" id="id_country_3">
AMERICA</label>
</li>
</ul>
</div>
<table class="datatable" id='table_id'>
<thead>
<thead>
<tr>
<th>Region</th>
<th> Area </th>
<th> Country </th>
</tr>
</thead>
<tbody>
<tr id="trow">
{% for i in database%} --- database retrieval
<td>i.Region</td>
<td>i.Area </td>
<td>i.Country</td>
</tr>
</tbody>
<script>
$(document).ready(function () {
$('#id_row').on('change', function(){
if ($(this).prop('checked')) {
$('#trow').show();
}
else {
$('#trow').hide();
}
});
});
</script>