The below jQuery creates variables from XML data and places it in markup. The variable can be used between the <button>
and </button>
but when I try to use the variable for creating an argument for the value
attribute (or anything else for that matter) I cannot. What is wrong with my syntax.
$.ajax({
type: "GET",
url: "Administration/data/people.xml"
}).done(function (xml) {
$(xml).find('fullName').each(function() {
var fullName = $(this);
$('<button></button>').attr('value', fullName).html(fullName).appendTo('#loadMe');
});
}).fail(function (response, error) {
$('#info').text('Error!!');
});
Dev Inspector shows:
<button value="[object] [Object]"><childnode>fullName</childnode></button>
But, instead, what I want is:
<button value="fullName">fullName</button>