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');
}