Exporting text and creating buttons from XML using JQuery

valzaq

New Member
I'm importing multiple text from an xml sheet and creating clickable buttons on the fly using Jquery into an existing html page and div.The text and clickable buttons seem to import okay, the buttons react to the mouse rollover, clickability, etc - all functionality seems there - but the script in my .click function in the .html page does not work.As a troubleshoot, I copied the html and paste directly from a live page (after importing from xml using the same method) into the same html page, and the button works perfectly - as you would expect.Is there something weird about the way this does or doesn't work with an xml import?Here is the full JQuery import from xml sheet block of code:\[code\]$(function(){ $('#hideText').click(function() { $("#readingText").fadeOut(100); $("#viewText").fadeIn(); $("#hideText").fadeOut(); var qnum = 1; $("#questions").empty(); $.ajax({ type: "GET", url: "mc1.xml", dataType: "xml", success: function(xml) { var quiz = "quiz"+qnum ++; $(xml).find(quiz).each(function(){ var id = $(this).attr('id'); var questionNo = $(this).find('questionNo').text(); var q1 = $(this).find('q1').text(); var A = $(this).find('A').text(); $('<div class="items" id="link_'+id+'"> </div>').html( '<p style="color:green">'+questionNo+ '</p>' + '<p style="color:red">' +q1+ '</p>' + '</p>').appendTo('#questions');$(this).find('choice').each(function(){var A = $(this).find('A').text();var B = $(this).find('B').text();var C = $(this).find('C').text();var D = $(this).find('D').text();var E = $(this).find('E').text(); $('<div id = "AA" class="1" ></div>').html('<p class="tab2"> <a href="http://stackoverflow.com/questions/10712730/#" class="q_but">A</a> '+A+' <br><br> ').appendTo('#link_'+id); $('<div id = "BB" class="2"></div>').html('<p class="tab2"> <a href="http://stackoverflow.com/questions/10712730/#" class="q_but">B</a> '+B+' <br><br>').appendTo('#link_'+id); $('<div id = "CC" class="3"></div>').html('<p class="tab2"> <a href="http://stackoverflow.com/questions/10712730/#" class="q_but">C</a> '+C+' <br><br>').appendTo('#link_'+id); $('<div id = "DD" class="4"></div>').html('<p class="tab2"> <a href="http://stackoverflow.com/questions/10712730/#" class="q_but">D</a> '+D+' <br><br>').appendTo('#link_'+id); $('<div id = "EE" class="5"></div>').html('<p class="tab2"> <a href="http://stackoverflow.com/questions/10712730/#" class="q_but">E</a> '+E+' <br><br>').appendTo('#link_'+id);$("#questions").fadeIn(2000); }); }); } }) });});\[/code\]Here is a test click function to test that the imported buttons ware working\[code\]$(function(){ $('#AA').click(function() { $("#questions").fadeOut(); }); })\[/code\]Many thanks for your help.
 
Back
Top