stevenjin 2023-02-27 23:17 采纳率: 98.2%
浏览 34
已结题

用jqeury获取选中table表格中单元格的内容

用jqeury获取选中选项卡table表格中单元格的内容
想到了如下 代码,但不能遍历整个表格,望指正,谢谢!

    $("div.tab-pane.active").each(function () {    
            debugger
            var tdArr = $(this).children();
            var Name = tdArr.eq(0).find('input').val();          
            });  

<div id="Level" class="container tab-pane active" style="margin:2px; font-size:20px;">
                    <table class="table table-striped">
                        <tbody>
                            <tr>
                                <td>
                                </td>
                            </tr>
                            <tr>
                                <td style="font-size:20px;color:#008A7D">Name</td>
                                <td>
                                    <input type="text" value="pH" class="form-control input-group input-group-lg" data-ajax-success="afterSuccess" data-ajax="true" style="font-size:20px;" id="DisplayName" name="DisplayName" />
                                    <input type="hidden" value="0" id="InDepth" name="InDepth" />
                                </td>
                            </tr>
                            <tr>
                                <td style="font-size:20px;color:#008A7D">Unit</td>
                                <td><input type="text" value="" class="form-control input-group input-group-lg" style="font-size:20px;" id="Unit" name="Unit" /></td>
                            </tr>
                            <tr>
                                <td style="font-size:20px;color:#008A7D">Screen Priority[0,65]</td>
                                <td><input type="text" value="10" class="form-control input-group input-group-lg" style="font-size:20px;" id="Unit" name="Unit" /></td>
                            </tr>
                            <tr>
                                <td style="font-size:20px;color:#008A7D">Decimals[0,4]</td>
                                <td><input type="button" value="2" class="form-control input-group input-group-lg" style="font-size:20px;" /></td>
                            </tr>
                            <tr>
                                <td><input type="submit" value="Confirm" class="form-control btn-primary" style="font-size:20px;" /></td>
                                <td><input type="reset" value="Cancel" class="form-control btn-secondary" style="font-size:20px;" /></td>
                            </tr>
                        </tbody>
                    </table>
                </div>                

  • 写回答

1条回答 默认 最新

  • 简效 2023-02-28 09:36
    关注
    
     $("div.tab-pane.active table input").each(function (i,v) {    
                var Name = $(i).val();
                console.log(Name)
                });  
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论 编辑记录

报告相同问题?

问题事件

  • 系统已结题 4月7日
  • 已采纳回答 3月30日
  • 创建了问题 2月27日

悬赏问题

  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改
  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持