0

I hope not repeat the topic, I don't find a post about it... I'm developing a webapp for FirefoxOS. I have a issue where I want to show more items when I click a button, and a item from those new items (another link) would be able to be click too and do what we want (call console in the example).

I have two tags in HTML:

<body>
<a id="one" class="class_a">One</a>
// if you click in this "one" link, you will see some text in console.log.

<a id="two" class="class_b">Two</a>
// if you click in this "two" link, you will charge on UI some new text and buttons.  
<div id="show_text"></div>
</body>

Then, in JS file I have:

$('one').click(function(){
  console.log("one");
});

function showItemsFromDB(element){
   document.getElementById('show_text').innerHTML += 
    "<li data-key=\""+element.key+"\">"+
      "<p id=\"list_items"+ element.key + "\" class=\"list_items\">"+
      "Number: "+ element.key+
      "<br/>Frecuency: " + element.value.frecuency +
      "</p>"+
      "<a id=\"one\" class=\"class_a\">ONE</a>"+
    "</li>";
}

$('two').click(function() {
  showItemsFromDB(element);
});

If I click in the first link , I could see in console.log the text "one". OK!!

When I click the second one , in the UI I can see the new items (text about the key number and frecuency and a link). If I click in this new link (which is a copy of ), it doesn't do anything...why??

Thanks in advance

imagonbar
  • 23
  • 7

0 Answers0