JSFiddle - React, Tailwind, and code Playground

by naokiota

HTML

<table border=1>
<tbody>
  <tr>
    <td class="nameCell">
      Big House
    </td>
    <td class="typeCell">
      Rent
    </td>
    <td class="priceCell">
      1000
    </td>
    <td class="yearCell">
      2009
    </td>
    <td class="descriptionCell">
      Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
      tempor
    </td>
    <span class="removeRow">
    </span>
  </tr>
  <tr>
    <td class="nameCell">
      Castle
    </td>
    <td class="typeCell">
      Sale
    </td>
    <td class="priceCell">
      500 000
    </td>
    <td class="yearCell">
      2005
    </td>
    <td class="descriptionCell">
      Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
      tempor
    </td>
    <span class="removeRow">
    </span>
  </tr>
  <tr>
    <td class="nameCell">
      Playboy Mansion
    </td>
    <td class="typeCell">
      Rent/Sale
    </td>
    <td class="priceCell">
      50 000
    </td>
    <td class="yearCell">
      2000
    </td>
    <td class="descriptionCell">
      Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
      tempor
    </td>
    <span class="removeRow">
    </span>
  </tr>
  <tr>
    <td class="nameCell">
      Adam's Family
    </td>
    <td class="typeCell">
      Rent/Sale
    </td>
    <td class="priceCell">
      100 000
    </td>
    <td class="yearCell">
      1996
    </td>
    <td class="descriptionCell">
      Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
      tempor
    </td>
    <span class="removeRow">
    </span>
  </tr>
  <tr>
    <td class="nameCell">
      Tom &amp; Jerry
    </td>
    <td class="typeCell">
      Rent
    </td>
    <td class="priceCell">
      2000
    </td>
    <td class="yearCell">
      1992
    </td>
    <td class="descriptionCell">
      Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
      tempor
    </td>
    <span class="removeRow">
    </span>
  </tr>
  <tr>
    <td...

JavaScript

$(function() {
	var min = lowestPrice();
    alert("min:"+min);
});
function lowestPrice() {
    var lowestCost = -1;
    //$('.cheapest a').click(function() {
        $('.typeCell').each(function() {
            if($(this).text().trim() == 'Sale') {
                var price = $(this).parent().find('.priceCell').text().trim();
                price = price.replace(/[^0-9\.]+/g, '');
                var i_price = parseInt(price,10);
                if(lowestCost = -1 || i_price < lowestCost) {
                    lowestCost = i_price;
                }
            }
        });
    //});

    return lowestCost;
}