0
I’m having a problem I made a Javascript code to display via AJAX an XML with a list: My XML is like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<telas>
<item>
<title>Lorem ipsum</title>
<title>Dolor sit amet</title>
</item>
<item>
<title>Lorem ipsum dolor</title>
<title>Ipsum dolor sit amet</title>
<title>Ipsum dolor sit amet</title>
</item>
</telas>
I want to list the tag content <item>
(XML) and put inside the <li>
(in my HTML) tag <title>
(XML), but only shows the contents of the first tag title
, i need you to show all tags <title>
that I have in XML.
I think the problem is that part of my code:
exibir+=tela[valor].getElementsByTagName('title')[0|1].firstChild.nodeValue;
How can I change this to work properly (the one I want)?
Can you post a little more of your js code to give context? One thing:
[0|1]
in this your line will always be worth as[1]
.– bfavaretto