html block wont work with javascript
Hello, I am currently trying to add Javascript to change the html text of the block. For some reason the block does not want to accept/recognize the Javascript. Is there a reason for this? should a feature be turned on? Do I need to structure the Javascript in a unique way?
Answer
Hello,
Yes, HTML blocks support javascript, no changes needed. anything like this will work. If you continue to have issues, please open a support ticket and one of our support engineers can look at what you are trying to do.
<h1 id='test'>Test</h1>
[script]
let testTarget = document.getElementById('test');
testTarget.innerHTML = "New Test";
[/script]
*note script tags changed so they can be shown in this editor.
Joe Hansen
Director of Solutions Support
Blox Digital
Then why does it not work here? I ran it on my a text editor and it works but not on Blox CMS.
Please create a support ticket so we can address this specifically for your site.
Joe
Customer support service by UserEcho
Hello,
Yes, HTML blocks support javascript, no changes needed. anything like this will work. If you continue to have issues, please open a support ticket and one of our support engineers can look at what you are trying to do.
<h1 id='test'>Test</h1>
[script]
let testTarget = document.getElementById('test');
testTarget.innerHTML = "New Test";
[/script]
*note script tags changed so they can be shown in this editor.
Joe Hansen
Director of Solutions Support
Blox Digital