JSFiddle - React, Tailwind, and code Playground

by revzephyr

JavaScript

//xxx.js
(function ($) {
    $.fn.s_table = function (options) {
        var settings = $.extend({
            //default
            "scrollY": "200px",
                "s_empty": "Not found"
        }, options);

        return this.septup({
            "scrollY": settings +"px",
                "s_empty": settings
        });
    };

    $(function () {
        //Setup the table
        $("<div>", {
            "class": "tablewrapper"
        }).insertBefore("#s_table");
        $("<table>", {
            "class": "header"
        }).appendTo($("<div>", {
            "class": "headerwrapper"
        }).appendTo("div.tablewrapper"));
        $("#s_table").appendTo($("<div>", {
            "class": "bodywrapper"
        }).appendTo("div.tablewrapper"));
        $("table#s_table>thead").clone().val("").appendTo("table.header");
        $("table.header>tr").removeClass("header_hidden");
        $("#s_table").find("thead tr").addClass("header_hidden");
        $("#s_table").find("tbody td:nth-child(2)").addClass("lefty");
        $("<input>", {
            type: "text"
        }).attr("id", "search-criteria").appendTo($("<div>", {
            "class": "s_box"
        }).insertAfter("div.headerwrapper"));
        $("<div>").attr("id", "count").appendTo("div.s_box");

        var otable=$("#s_table"),
            bodyTd = this+("tr td"),
            row = "#s_table tbody>tr",
            srowCount = $(row).filter(":visible").length,
            scrollY = (".bodywrapper").css({
                "height": ""
            }),
            s_empty = string;

        //resize the table
        resizeTable();
        $(window).resize(resizeTable);

        //display current row count
        document.getElementById('count').innerHTML = srowCount;

        //search function
        $("#search-criteria").on("keyup", function () {
            var keyword = $(this).val().replace(/[A-Za-z0-9]/g, function (td_word) {
                return String.fromCharCode(td_word.charCodeAt(0) -...