Script:
var degress = GiveDegrees();
$(function () {
//alert(GiveDegrees()); //output: 89,91,87,90,91
});
function GiveDegrees() {
var divs = $('p.wx-temp');
var degrees = new Array();
$.each(divs, function (i, j) {
degrees.push(stringToNum($(this).text()));
});
return degrees;
}
function stringToNum(str) {
return str.match(/\d+/g);
}
I have this :
$("p.wx-temp").each(degress, function (index) {
$(this).append(degress[index], "<sup>°C</sup>");
alert("I works");
});
But It does not work. when I write like this:
$("p.wx-temp").each(function (index) {
$(this).append("<sup>°C</sup>");
alert("I works");
});
It works. Is there no overload method for .each() function .each(data, function (index)) ?
degrees array is integer array that include five int as 89,91,87,90,91. How can I use .each function to add array values to each p element.
Thanks.
{89,91,87,90,91}is not a valid object.