2 Replies Latest reply on Jul 16, 2008 4:35 AM by 4t5g4tr4y654bhrtgv

    JS onclick events not firing in dynamically created elements

    4t5g4tr4y654bhrtgv
      I'm creating a chunk of HTML in javascript and then writing it to the page with:

      quote:

      document.getElementById('formContent').innerHTML = sFormHTML;


      The HTML output includes the following:

      quote:

      <input type="button" value="Update" id="btnSubmit1" onclick="saveXML();" />


      When I click this button, no event is fired.

      If I take the button code and paste it directly into the <body> - when I click that, the event is fired.

      Any suggestions?