<script src="https://code.jquery.com/jquery-1.9.0.min.js"></script> <script> $(function(){ $(".cart-item-pr").each(function(){ var price = $(this).find("td.price span").text(); $(this).find("input.rchecking").filter(function(i, e){return $(e).val() == price;}).prop("checked", true); }); }) </script> <table> <tr id="" class="cart-item-pr"> <td class="weight"> <input type="radio" class="rchecking" id="c2" name="price-hours1" value="100" /><label for="c2"></label> <input type="radio" class="rchecking" id="c3" name="price-hours1" value="200" /><label for="c3"></label> <input type="radio" class="rchecking" id="c4" name="price-hours1" value="300" /><label for="c4"></label> <input type="radio" class="rchecking" id="c5" name="price-hours1" value="400" /><label for="c5"></label> </td> <td class="price"> <span id="price">200</span> </td> </tr> <tr id="" class="cart-item-pr"> <td class="weight"> <input type="radio" class="rchecking" id="c2" name="price-hours2" value="100" /><label for="c2"></label> <input type="radio" class="rchecking" id="c3" name="price-hours2" value="200" /><label for="c3"></label> <input type="radio" class="rchecking" id="c4" name="price-hours2" value="300" /><label for="c4"></label> <input type="radio" class="rchecking" id="c5" name="price-hours2" value="400" /><label for="c5"></label> </td> <td class="price"> <span id="price">400</span> </td> </tr> </table>