Reputation: 1841
I have this function :
if (location.locationUrl != '') {
content += "<a class='viewLocationPage btn corePrettyStyle' " +
(mapObject.options.openinnew == false ? "" : "target='_blank'") +
" href='" + location.locationUrl + "' >View location detail</a>";
}
and I've added the rel attribute like this:
if (location.locationUrl != '') {
content += "<a class='viewLocationPage btn corePrettyStyle' " +
(mapObject.options.openinnew == false ? "" : "target='_blank'") +
"rel='prettyPhoto[iframes]'" + " href='" + location.locationUrl + "' >View location detail</a>";
}
but is not working, it doesn't add any rel attribute into the markup. Any suggestions on how can I make this work ?
Upvotes: 0
Views: 500
Reputation: 298206
Since you're already using jQuery, it'd be easier to create the element with the jQuery constructor:
if (location.locationUrl != '') {
$('<a>', {
'class': 'viewLocationPage btn corePrettyStyle',
target: mapObject.options.openinnew ? '_blank' : '',
rel: 'prettyPhoto[iframes]',
href: location.locationUrl,
text: 'View location detail'
}).appendTo('#selector');
}
Upvotes: 1