小编sni*_*ggy的帖子

只需单击即可获取表行数据

我有一个表,我想允许用户点击表上的任何元素来获取数据行.我怎么做?

例如,在我看来,我有一个这样的表.

      <table class="myTable">
      :     <tr class="table">
                <th class="table">
                    Client ID
                </th>
                <th class="table">
                    Client Name
                </th>
                <th class="table">
                    Client Address
                </th>
            </tr>
Run Code Online (Sandbox Code Playgroud)

当我运行项目时,我会得到这样的东西:

在此输入图像描述

如果用户单击列客户端名称:BBB.它将有一个弹出窗口说:您好,您已选择客户端ID:002,客户端名称:BBB,客户端添加:xxxxx.

用户可以单击所有列,它仍然会在弹出窗口中返回整行数据.

这该怎么做?请帮忙.

HTML:@model IEnumerable @ {ViewBag.Title ="Client"; Layout ="〜/ Views/Shared/_Layout.cshtml"; }

<div class="body">

<div class="outer">
    <div class="inner">
        <table class="myTable">
            <tr class="table">
                <th class="table">
                    Client Name
                </th>
                <th class="table">
                    Client Code
                </th>
                <th class="table">
                    Client Address
                </th>
                <th class="searchTable">
                    Client Lead Partner
                </th>
            </tr>
            @foreach (var i in Model)
            {
                <tr class="myTable">
                    <td class="table">@i.ClientName
                    </td>
                    <td …
Run Code Online (Sandbox Code Playgroud)

jquery html-table

8
推荐指数
1
解决办法
4万
查看次数

标签 统计

html-table ×1

jquery ×1