JSFiddle - React, Tailwind, and code Playground

by Paf_Sebastien

HTML

<body>
    <select id="dropdown">
        <option value="select">Select</option>
        <option value="insert">Insert</option>
    </select>
    <hr />
    <div id="select">Customername
        <br>
        <input type="text" name="Customername" id="select">
        <br>StartDate
        <br>
        <input type="date" name="Startdate" id="select">
        <br>Enddate
        <br>
        <input type="date" name="EndDate" id="select">
        <br>
    </div>
    <div id="insert">
        <br>FromDate
        <br>
        <input type="date" name="Startdate" id="insert">
        <br>Todate
        <br>
        <input type="date" name="EndDate" id="insert">
        <br>
    </div>
</body>

JavaScript

$(function () {
    $("#dropdown").change(function () {
        if ($("#dropdown").val() == "select") {
            $("#select").show();
            $("#insert").hide();
        } else {
            $("#select").hide();
            $("#insert").show();
        }
    });
    
    $("#dropdown").change();
});