【问题标题】:jQuery - loop over select tag base on row locationjQuery - 基于行位置循环选择标签
【发布时间】:2017-12-28 08:24:40
【问题描述】:

如何根据所选行循环选择标签选项。请看我的截图

一旦用户单击更新按钮,我需要遍历位于所选行上的 3 个选择标签选项。 我有这段代码已经在处理选择事件了。

$('select.selectedsystem').on('change', function () {
        var selectedText = $(this).val();
        var user = $(this).parents('td').prev().text();
        var syslvl = $(this).parents('td').next();
        var sysbranch = $(this).parents('td').nextAll().eq(1);
        var sysunit = $(this).parents('td').nextAll().eq(2)
        syslvl.text("Retrieving...");
        sysbranch.text("Retrieving...");
        sysunit.text("Retrieving...");

    }).change();

【问题讨论】:

    标签: jquery loops select html-table each


    【解决方案1】:

    如果它是一个表单,那么您可以使用每个循环和表单 id 循环遍历表单元素。

    请看下面的代码

    $("#form :select").each(function(){
            // Your stuff
    });
    

    【讨论】:

    • 嗨,不,这不是我只有表格的表格。
    • 可以循环遍历表格本身,参考stackoverflow.com/questions/3065342/…
    • 是的,但我的问题是在循环过程中,当我遇到选择标签时,如何遍历选择标签内的项目。
    • 使用jquery自己选择表数据里面的select(td)
    • 是否有任何与该选择相关的 id?
    猜你喜欢
    • 2015-01-19
    • 1970-01-01
    • 1970-01-01
    • 2021-02-04
    • 2012-08-06
    • 2018-01-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多