[jQuery] Table Row Edit , Add ,Delete

by ShadowKao

HTML

<!doctype html>
<html>
<head> 
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css"
          integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
    <title>jQuery 操作Table新增、刪除並儲存</title>
    <style type="text/css">
        body {
            padding-top: 30px;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="row">
            <div class="col-12">

                <div class="clearfix"> 
                    <button class="btn btn-info float-right" id="btnAdd">新增</button>
                </div>
                <hr />

                <form method="post" action="/">
                    <table class="table table-striped table-bordered table-hover">
                        <thead class="thead-light">
                            <tr>
                                <th>姓名</th>
                                <th>職業</th>
                                <th>性別</th>
                                <th>是否成年</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody id="tbody">
                        </tbody>
                    </table>
                    <hr />

                    <div class="clearfix">
                        <button class="btn btn-primary float-right" id="btnSubmit" type="button">儲存</button>
                    </div>
                    <div>
                        <pre>
                         
                         </pre>
                    </div>
                </form>
            </div>

        </div>
    </div>


    <!-- jQuery first, then Popper.js, then Bootstrap JS -->
    <script src="https://code.jquery.com/jquery-3.3.1.min.js" crossorigin="anonymous"></script>
    <script...