Line 50 is where the problem occurs. I tried switching: "$(ul).append($(this).html());" with: "$(this).wrapAll($(ul));" but that causes the html of $(ul) to not append or something like that. Or atleast it doesnt show up in all browsers.
I have a question concerning :contains(). I use it in the following manner:
if($("div:contains('Built From')", $(itemProps)))
{
//Do stuff.
}
itemProps is DOM Element. It has a a div inside it which class is always something else however that div has either "Built From" or "Builds Into" as a text. Inside itemProps there is no other div with those words.
I want to know which of those texts the div within itemProps contains. However this bit of code seems to always return true. Some goes for when I use the text "Builds Into". Even when the text is not in the div.
Why does this happen? I put up a live example here.
As I need the 2 numbers I thought I'd split the string by using .split(<br>).
Then using the [0] and [2] indexes I assign the numbers to two variables.
All together it looks like this:
var goldInfo = $("span.big", $(this)).html().split("<br>");
var itemCost = goldInfo[0];
var itemTotalCost = goldInfo[2];
Don't worry about the $(this) part it works fine.
For some reason IE doesnt like this. It doesnt break the string into separate pieces but it takes the entire string and places it in [0] resulting in [2] being undefined. FF however doesn't mind at all and works fine.
FYI: I also tried to just remove both the <br> and replace the <img> with an "/" and then split it. Didn't work as well. Maybe someone can elaborate on that approach. Though I think it's a bit of overkill.