I’m appending some buttons from an XML-file, into some divs. Each div has one or two buttons in them.
In each Each(), append the buttons through a var. But after each button insert, the Each() overwrites the var.
How can I make a unique var, for each append??
It’s the “buttonMarkup” I would like to have, as unique vars, so they don’t overwrite eachother…
$(this).find('button', this).each(function(index) {
var type = $(this).attr("type");
var label = $(">label", this).text();
var wunLink = $(">link", this).text();
buttonMarkup = "<a href='" + wunLink + "' class='" + type + "'><span>" + label + "</span></a>";
});
How do I do this??
Thank you in advance… 🙂
just a + to the equal and it will concatenate the string
so then you will have one long string in buttonMarkup that you can use to append(buttonMarkup)