0

I am using jquery datable editable Basically I want to get the id of the image defined in cell 0 , how do I get that ? Below is the code

var data = new Array();

       $.each(oTableabc.fnGetData(), function(i, row) {

           dataArray.push({
                "RefId": row[0] ,
                "Center": row[1],
        "cust":row[2]   


            });


         });

What I am refering to row[0] contains an image and is defined as below,

        <thead>
        <!-- Header Row -->
        <tr >
              <th>RefId</th>
              <th>Center</th> 
              <th>cust</th>

        </tr>
        </thead> 


        @foreach (var as in mod)
     { 

        <tr>
              <td  > <img src="/Content/Images/details_open.png"    alt="expand/collapse" class="original" id= "@as.RefId.ToString()"  /> </td>
             <td>  @Html.DisplayFor(modelItem=>as.center ) </td>
             <td>  @Html.DisplayFor(modelItem => as.cust) </td>


       </tr>
     }

          </tbody> 
       </table>   
4

1 回答 1

0

您忘记在循环<tbody>之前添加。foreach

var ids = $('#tbls tbody td img').map(function() {
    return this.id;
});

演示

于 2012-12-06T19:18:22.987 回答