How to get the row index in a HTML table

前端 未结 4 389
抹茶落季
抹茶落季 2021-01-14 08:10

I\'m trying to update a database users table. I made an HTML table which contains the data of the users in my database. this HTML table contains 3 columns and in each row t

4条回答
  •  温柔的废话
    2021-01-14 09:07

    You can use like this

    $("button").click(function () {
        var inputValue = $(this).closest("tr").find("input[type=text]").val();
        var selectValuse = $(this).closest("tr").find("[name='select_job']").val();
        var index = $(this).closest("tr").index();
    });
    

提交回复
热议问题