Reputation: 397
I want set new in span,
var email ='[email protected]';
document.getElementById('spanEmail').innerHTML='<a class="f14 bold rose" href="mailto:'+email+'>'+email+'</a>';
but this way not working , but this working
document.getElementById('spanEmail').innerHTML='sample text>';
How replace this span content ?
Upvotes: 1
Views: 4668
Reputation: 1870
You are missing a closing " the code should read:
document.getElementById('spanEmail').innerHTML='<a class="f14 bold rose" href="mailto:'+email+'">'+email+'</a>';
Upvotes: -1
Reputation: 120456
You haven't closed your href attribute with a double-quote.
href="mailto:'+email+'>
Should be
href="mailto:'+email+'">
Upvotes: 3