JSFiddle - React, Tailwind, and code Playground
by Junior Software Engineer
HTML
<!DOCTYPE html>
<html>
<head>
<style>
#example select
{
width:40px !important;
}
#example #hello select{
width:250px;
}
</style>
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
<script>
$(document).ready(function() {
$('#example').DataTable({
"dom": '<"top"iflp<"clear">>rt<"bottom"iflp<"clear">>',
initComplete: function() {
this.api().columns().every(function() {
var column = this;
var select = $('<select><option value=""></option></select>')
.appendTo($(column.header()))
.on('change', function() {
var val = $.fn.dataTable.util.escapeRegex(
$(this).val()
);
column
.search(val ? '^' + val + '$' : '', true, false)
.draw();
});
column.data().unique().sort().each(function(d, j) {
select.append('<option value="' + d + '">' + d + '</option>')
});
});
}
});
$("textarea").on("keyup", check)
});
function check() {
var el = this;
setTimeout(function() {
el.style.cssText = 'height:auto; padding:0';
el.style.cssText = 'height:' + el.scrollHeight + 'px';
}, 0);
}
function submitvallues(button)
{
debugger;
var dropdownvalue="saab";
var row=$(button).closest('tr');
var dynamicdropdown = $("#cars").clone().val(dropdownvalue);
dynamicdropdown.attr("id","hello");
...