I am learning code, but have been tasked with creating a table, and when the user selects from multiple drop-down lists, whatever the user selected, is displayed in the table. (non-selected rows get hidden)
I want to place the code into a new html file and have it run. (my test is to cut and paste it into a txt doc, then change the name to html for testing) I can do this for other types of scripts, but for some reason, I cannot seem to get this one to run.
<script language="javascript">
$(document).ready(function () {
$('select.ddlFilterTableRow').bind('change', function () {
$('select.ddlFilterTableRow').attr('disabled', 'disabled');
$('#tableRegisterKids').find('.Row').hide();
var critriaAttribute = '';
$('select.ddlFilterTableRow').each(function () {
if ($(this).val() != '0') {
critriaAttribute += '[data-' + $(this).data('attribute') + '="' + $(this).val() + '"]';
}
});
$('#tableRegisterKids').find('.Row' + critriaAttribute).show();
$('#headerCount').html($('table#tableRegisterKids tr.Row:visible').length + ' Registered Kids');
$('select.ddlFilterTableRow').removeAttr('disabled');
});
});</script>
<select id="ddlAge" class="ddlFilterTableRow" data-attribute="age">
<option value="0">Select All</option>
<option value="10">10</option>
<option value="8">8</option>
<option value="6">6</option>
</select>
<select id="ddlSport" class="ddlFilterTableRow" data-attribute="sports">
<option value="0">Select All</option>
<option value="Foot Ball">Foot Ball</option>
<option value="Chess">Chess</option>
<option value="Cricket">Cricket</option>
<option value="Bowling">Bowling</option>
</select>
<h1 id="headerCount"></h1>
<table id="tableRegisterKids">
<tr>
<th>Fullname</th>
<th>Age</th>
<th>Sport</th>
</tr>
<tr class="Row" data-age="10" data-sports="Foot Ball">
<td>Thulasi Ram.S</td>
<td>10</td>
<td>Foot Ball</td>
</tr>
<tr class="Row" data-age="8" data-sports="Cricket">
<td>Ram</td>
<td>8</td>
<td>Cricket</td>
</tr>
<tr class="Row" data-age="6" data-sports="Chess">
<td>Ram Kumar.S</td>
<td>6</td>
<td>Chess</td>
</tr>
<tr class="Row" data-age="8" data-sports="Bowling">
<td>Dinesh Kumar.S</td>
<td>8</td>
<td>Bowling</td>
</tr>
<tr class="Row" data-age="6" data-sports="Bowling">
<td>Raja Ram.S</td>
<td>6</td>
<td>Bowling</td>
</tr>
<tr class="Row" data-age="10" data-sports="Chess">