Firstly, I recommend using addEventListener over an onClick attribute - this will give us an event to work with that can be used to target the element without querying a selector.
I'd also recommend storing this data and accessing it in a different way than getting the content of an HTML tag - data attributes are a well supported standard.
I've taken the liberty of tidying up the table markup, too, so it has a semantically correct header and body:
<table border=1 id='products'>
<thead>
<tr>
<th>item id</th>
<th>item Name</th>
<th>item Price</th>
</tr>
</thead>
<tbody>
<tr>
<td><input type='checkbox' data-product='rice' data-price='300'></td>
<td>Rice</td>
<td>300</td>
</tr>
<tr>
<td><input type='checkbox' data-product='sugar' data-price='200'></td>
<td>Sugar</td>
<td>200</td>
</tr>
<tr>
<td><input type='checkbox' data-product='tea' data-price='100'></td>
<td>Tea</td>
<td>100</td>
</tr>
</tbody>
</table>
With this, we can rewrite our JS to add an event listener to each of the inputs:
let inputs = document.querySelectorAll('input[type="checkbox"]')
for (let input of inputs) {
input.addEventListener('click', (event) => {
const product = event.target.dataset.product
const price = event.target.dataset.price
})
}
document.querySelectorAll returns an Array of all elements that match the selector on the page.
We can then iterate over this array to do the same thing to each input - in this case, apply an eventListener.
This eventListener will be for the 'click' event, and the second argument is the function that will be run when the event is triggered.
The argument of this second function is event, which contains all the information about the event. We can use event.target to get the element that was clicked, and then event.target.dataset to get all the data properties of that HTML element.