I have an XML file that stores a bunch of stuff, including the page number of a reference book. If there are multiple pages, they are separated with a slash like this:
<WeaponPage>119/120</WeaponPage>
I then use jQuery to populate this data in a fancy anchor hover to show the data when the user hovers over the hyperlink. No problem so far. The HTML that gets loaded looks like this:
<td><span id="weaponPage2" name="weaponPage2"></span></td>
The jQuery looks like this:
$("#weaponPage"+person).text(WeaponsArray[xx1][23].replace("/","<br>"));
For some strange reason, the data is being rendered as 119<br>120. It is actually showing the break tag and not rendering it as a break! If I comment out the jQuery and hard-code the data in the HTML, it works just fine, but obviously, that is for debugging only.
Any ideas?
Thanks
use .html() instead
since .text() will render it as a text and ignore html content