JSFiddle - React, Tailwind, and code Playground

by Thet Hlaing

HTML

<script src="https://code.jquery.com/jquery-2.2.0.min.js"></script>
<table>

<tr>
            <td class="product_id">product_id</td>
            <td class="brand">brand</td>
            <td class="category">category</td>
            <td class="description">description</td>
            <td class="price">price</td>
            <th></th>
            <th><button type="button" class="btn btn-info" id="btn-add">Add to Cart</button></th>
        </tr>
        </table>

JavaScript

$("button").click(function() {
            id =  $(this).parent().parent().children('td.product_id').text();
            price = $(this).parent().parent().children('td.price').text();
            
            alert(id+'-'+price);
        });