Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

writing html with functions

This words to set the html but when it happens it not only writes the h1 element but it also writes the whole function, how can I make it so it only writes whats inside of the two `

function tokens() {
        return `
        <h1>test</h1>
    `;
}

document.getElementById('tokens').innerHTML = tokens;

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Change

document.getElementById('tokens').innerHTML = tokens;

by this

document.getElementById('tokens').innerHTML = tokens();
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading