Hi all,
I have a question about something odd.
I get html() from within an element which looks like this:
"somenumber<br><img etc='etc"></img><br>somenumber".
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.
Here's the entire code for reference:
http://codestairway.com/LoLItemsHierachy/Why does this happen?
Thanks in advance:).
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.