JSFiddle - React, Tailwind, and code Playground

by Simon Price

HTML

<table>
    <tbody>
        <tr id="r_001">
            <td>63</td>
            <td>Computer</td>
            <td>3434</td>
            <td>
                <button class="btn-medium btn-danger remove" id="mprDetailRemove"><i class="icon-remove"></i>
                </button>
            </td>
        </tr>
        <tr>
            <td>64</td>
            <td>Stationary</td>
            <td>111</td>
            <td>
                <button class="btn-medium btn-danger remove" id="Button1"><i class="icon-remove"></i>
                </button>
            </td>
        </tr>
        <tr id = r_002>
            <td>64</td>
            <td>Stationary</td>
            <td>11</td>
            <td>
                <button class="btn-medium btn-danger remove" id="Button2"><i class="icon-remove"></i>
                </button>
            </td>
        </tr>
    </tbody>
</table>

JavaScript

var table = $("table tbody");


    table.find("tr[id^='r_']").each(function (i) {
    var row = $(this).closest('tr');
    alert(row[0].id);
            //var $tds = $(this).find('td'),
            //productId = $tds.eq(0).text(),
            //product = $tds.eq(1).text(),
            //Quantity = $tds.eq(2).text();
        // do something with productId, product, Quantity
       // alert('Row ' + (i + 1) + ':\nId: ' + productId
              //+ '\nProduct: ' + product
              //+ '\nQuantity: ' + Quantity);
    });