Result of an ajaxget in bold

Hi all,

I’m trying to put the result of an ajax call in bold…
ex the AJAX call return

var zone =;

I want this zone be in bold, in the sentence

result.textContent = ‘At’ + zone + ‘there is a lot of water’;

I’m searching since yesterday… :frowning2:
Thanks a lot for your help !

Is textContent HTML? If so, then I think

'At <b>' + zone + '</b> there is a lot of water'

will work

Thanks for your comment, but no, the sentence is on javascript, so "< b> " is on the screen when i do that (sorry i’m french, i don’t know if i speak well…)

Are you working on codepen? Maybe you can show it?

(and don’t worry about your English :wink:)

thanks :slight_smile:

here :

About this line,

var  resultatElt = document.getElementById('resultat');

there isn’t any element in your HTML with an id of resultat.

Also, textContent renders strings as is (so tags like <b> will be printed as is and not get interpreted as HTML tags). You may want to use innerHTML instead.

Yes, i did it on sublime text because i do my tests on sublime and after un put all in codepen, in my mind it’s easier, but in sublime text i put this.
I made the change on codepen you can see it now :wink:

Just change textContent to innerHTML and use the string I made in my first post. That should work.

1 Like

YES ! It works !
Thanks a lot :grin: