tag <h1>testo<h1> - Forum

Forum Navigation
You need to log in to create posts and topics.

tag <h1>testo<h1>

How can I change the text in an h1 tag or other tags from code.
What syntax to access the text element in h1.

Grazie

Hi @llazzari , you can use javascript to do that.

Imagine the container with the code:

<h1>Test!</h1><br>
<h1 id="title">Hello world!</h1>

 

And you have a push button with this code to change the content:

beginjs
//change the first h1 element 
document.getElementsByTagName("h1")[0].innerHTML = "changed test!";
//change the element with id=title
document.getElementById("title").innerHTML="changed world!";
endjs

 

luishp has reacted to this post.
luishp

@llazzari @emmanuel-fernandez if your html tag has an id it's very easy to change the content. So for:

<h1 id="title">Hello world!</h1>

It would be:

SetObjectHTML "title" "My new HTML content"

Regards

 

Vadim, emo and javadrajabihakami have reacted to this post.
Vadimemojavadrajabihakami