I was simply wondering how I would add html code inside a javascript variable? For example, I want to use HTML code (a <a href="/example.html"> link piece of code) in one of the message lines:
var messages = [
"Please wait while we handle your request...",
"This is taking longer than usual to process - please wait...",
"We seem to be having trouble - please click here to contact support"
];
$.each(messages, function(index, message) {
setTimeout(function() {
$('#wrapper').append(
$('<p />', {text : message})
)
}, index * 1500); // 1.5 seconds, add a zero for 15 seconds
});
So it would be like:
var messages = [
"Please wait while we handle your request...",
"This is taking longer than usual to process - please wait...",
"We seem to be having trouble - please click <a href="/help.html">here</a> to contact support"`
Is there a way of doing this?
htmlinstead oftext.