Jquery can't seem to turn the type of str2 into a string, no matter what i tried.
function parseXml(xml)
{
$(xml).find("product").each(function()
{
var str1 = "div.timer";
var **str2** = $(this).find("id");
$("div.timer17").html(str1 + str2);
});
}
Every time this function is ran, content of div.timer17 changes to div.timer[object Object].
I tried turning the object Object into a string with new String(obj), with json.stringify, etc. Nothing worked. Please help.
My goal is appending str2 to str1, so i can get the wanted selector (for example, div.timer25).
Here's the xml:
<?xml version="1.0" encoding="utf-8" ?>
<products>
<product cookie="The red">
<timediff>02:28:59</timediff>
<username>denis</username>
<price>25</price>
<id>17</id>
</product>
<product cookie="The red">
<timediff>00:28:59</timediff>
<username>denis</username>
<price>35</price>
<id>18</id>
</product>
</products>