Hey @MarsTech,
You need to add the hr ID, it’s the block id.
When you press on the block on the right corner you will see it. In my case it is user-accounts5, simply go to your block settings to find our yours
Hey @MarsTech,
You need to add the hr ID, it’s the block id.
When you press on the block on the right corner you will see it. In my case it is user-accounts5, simply go to your block settings to find our yours
Hi Suzie,
I made the following changes, but its still not working. Am I missing something?
Can I please ask you to contact via chat, perhaps we will need to check some more details
Hey @MarsTech, @Suzie could you share how you solved this? if you did. Not working for me. Tried adding the Block id both with quotes and without. No luck.
My block
My code
<script>
window.addEventListener('block-loaded-{alta-usuario}', () => {
var label = document.querySelector("label[for='terms_and_privacy']");
var paragraph = label.querySelector('p');
var childElements = paragraph.children;
var paragraph1 = childElements[0];
var paragraph2 = childElements[1];
paragraph1.firstChild.textContent = 'Acepto';
var linkElement1 = paragraph1.querySelector('a');
linkElement1.textContent = 'Condiciones';
paragraph2.firstChild.textContent = 'y';
var linkElement2 = paragraph2.querySelector('a');
linkElement2.textContent = 'Política de privacidad';
});
</script>
Thanks
Hi,
You just need to remove {
and }
for alta-usuario in window.addEventListener('block-loaded-{alta-usuario}', () => {
<script>
window.addEventListener('block-loaded-alta-usuario', () => {
var label = document.querySelector("label[for='terms_and_privacy']");
var paragraph = label.querySelector('p');
var childElements = paragraph.children;
var paragraph1 = childElements[0];
var paragraph2 = childElements[1];
paragraph1.firstChild.textContent = 'Acepto';
var linkElement1 = paragraph1.querySelector('a');
linkElement1.textContent = 'Condiciones';
paragraph2.firstChild.textContent = 'y';
var linkElement2 = paragraph2.querySelector('a');
linkElement2.textContent = 'Política de privacidad';
});
</script>
Classic one that would take me a life time to spot, thanks heaps
Hey @yannick, can you try this code? Just replace the BLOCKID with the block name
<script>
window.addEventListener('block-loaded-BLOCKID', () => {
document.querySelectorAll('#BLOCKID .form-input-label')[0].innerText = 'TRANSLATION FOR EMAIL';
document.querySelectorAll('#BLOCKID .form-input-label')[1].innerText = 'TRANSLATION FOR PASSWORD';
});
</script>
It works very well thank you
All that’s missing is being able to translate the error message
Yes, @yannick, it’s included in our feature requests and soon it will be possible to translate them via custom code
Unfortunately, this solution no longer works and creates errors in the console -_-
Hi Yannick,
Add a 100ms delay just to be sure the block is fully loaded.
Inside the header custom code of the page. From now on, almost all Javascript should be in the header, as the blocks are loaded faster than before.
<script>
window.addEventListener('block-loaded-BLOCKID', () => {
setTimeout(() => {
document.querySelectorAll('#BLOCKID .form-input-label')[0].innerText = 'Courrier';
document.querySelectorAll('#BLOCKID .form-input-label')[1].innerText = 'Mot de passe';
}, 100);
});
</script>
Haha. Well, it works like a charm, thanks !
I imagined that the block-loaded...
would be there to avoid that.
Good news for loading speed
Did you find a way to do it on the free plan? I can’t figure this out