如何自动向表行添加时间戳并在更改时增加手提包#

我需要在用户输入他们的姓名首字母后自动添加时间戳,然后将创建新行,并且我需要将下一行的 tote# 增加到下一个数字,例如。(第 2 行 tote# 将是 2 )


这是我的表结构


<table id="harvestedCannabis">

                        <tr>

                            <th>Tote #</th>

                            <th>Flowers</th>

                            <th>Trim A</th>

                            <th>Trim B</th>

                            <th>Waste</th>

                            <th>Originating Line(A,B,C)</th>

                            <th>Preformed By</th>

                            <th>Time Stamp</th>

                        </tr>

                        <tr>

                            <td>1</td>

                            <td><input type="number" step=".1"></td>

                            <td><input type="number" step=".1"></td>

                            <td><input type="number" step=".1"></td>

                            <td><input type="number" step=".1"></td>

                            <td><input type="text"></td>

                            <td><input type="text" id="preformedBy"></td>

                            <td id="timeStamp"></td>

                        </tr>

                    </table>

这是我的 JS


$(document).ready(function(){

    $("#preformedBy").change(function(){

        $('#harvestedCannabis > tbody:last-child').append('<tr><td>1</td><td><input type="number" step=".1"></td><td><input type="number" step=".1"></td><td><input type="number" step=".1"></td><td><input type="number" step=".1"></td><td><input type="text"></td><td><input type="text" id="preformedBy"></td><td id="timeStamp"></td></tr>');

    });

  });

我希望在用户输入他们的 initails 时自动输入时间戳并增加 tote#


慕桂英546537
浏览 131回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript