compare 2 prices in jquery, if they match add a class?
<p>How would i go about adding a class to an element in jquery, if 2 prices i return match?</p>

<p>Say both items (Price1 and Price2) are being returned via JSON, if they match add class="red" to an element.</p>

<p>Below is my existing code, I need to match <strong>res.amzprice</strong> and <strong>res.lowprice</strong>, if both match i need to add a class to the res.lowprice td :)</p>

<pre><code> $.ajax({ type: "POST",
    url: "aWeb.asmx/GetLowPrices",
    data: "{ }",
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: function (response) {
        $('#loading').hide();
        var result = response.d;
        var new_record = "";
        $.each(result, function (index, res) {
            new_record = "&lt;tr id=\"" + res.sku + "\"&gt;" +
                         "&lt;td scope=\"row\" class=\"t-left\"&gt;&lt;a href=\"../product/editproduct.aspx?sku=" + res.sku + "\" title=\"Edit this product listing\"&gt;" + res.title + "&lt;/a&gt;&lt;/td&gt;" +
                         "&lt;td&gt;" + res.sku + "&lt;/td&gt;" +
                         "&lt;td&gt; £" + res.tprice + "&lt;/td&gt;" +
                         "&lt;td class=\"amzprice-edit\"&gt;&lt;input type=\"text\" id=\"txt" + res.sku.replace(/[^a-z0-9\s]/gi, '').replace(/[_\s]/g, '-') + "\" value=\"" + res.amzprice + "\"&gt; &lt;img src=\"images/icons/info.png\" alt=\"Info\" title=\"Price (inc. Shipping): £xx.xx\" /&gt;&lt;/td&gt;" +
                         "&lt;td&gt; £" + res.lowprice + " &lt;img src=\"images/icons/info.png\" alt=\"Info\" title=\"Price: £xx.xx | Shipping: £xx.xx\" /&gt; &lt;a href=\"lowpricedata.aspx?sku=" + res.sku + "\" id=\"lnkInfoGrpah\" class=\"link-to info-graph\" data-fancybox-type=\"iframe\"&gt;&lt;img src=\"images/icons/graph-icon.png\" alt=\"Info\" title=\"View Lowprice History\" /&gt;&lt;/a&gt;&lt;/td&gt;" +
                         "&lt;td&gt;&lt;div class=\"twe-button mini update\"&gt;Update&lt;/div&gt;&lt;/td&gt;" +
                         "&lt;/tr&gt;";

            $('#dataResults').append(new_record);
        });

    },
    error: function (msg) {
        $('#loading').hide();
        $('#dataTable').hide();
        $('#infoMsg').show();
        $('#infoMsg').addClass('er-red');
        $('#infoMsg').html("Error while calling web service.");
    }
});
</code></pre>
