I'm trying to add a dropdown value to a attribute in the table below. But it doesn't seem to work using the .attr() from jQuery
This is the jquery:
$("#datasize").change(function(){
var element = $(this).find('option:selected');
var myTag = element.val();
$('#filterTable1').attr('data-page-size' , myTag);
});
This is the html:
<select id="datasize">
<option value="10">My option</option>
<option value="20">My other option</option>
</select>
<table class="footable" data-page-size="" id="filterTable1">
<thead>
<tbody>
</tbody>
</thead>
</table>
Any help would be appreciated!