Hi
I'm creating a landing page for unsubscribe and what it shou;d do:
When opening the landing page, the checkbox for the option 'unsubscribe' should be automatically checked so that the user does not have to do this anymore. I'm trying to get this result with a script, but it's not working.
Script:
<script>
window.addEventListener('lpRuntimeReady',function(e){
init(e.detail)
}
function init(lpRuntime){
window.getElementByTagName('acr-form-checkbox-4').checked = true;
})
</script>
I'm adding this at the top of my landing page with an html content. Can someone help me and let me know what I'm doing wrong?
Thank you!
Kr
Lara
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
In the mean time my colleague found the solution.
New code:
<script>
window.addEventListener('lpRuntimeReady',function(e) {
init(e.detail)
});
function init(lpRuntime) {
console.log('check unsubscribe checkbox');
document.getElementsByName('acr-form-checkbox-4')[0].checked = true;
}
</script>
@siljkla try this code
<script>
// Get the checkbox element
var checkbox = document.getElementsByName("acr-form-checkbox-4");
// Check the checkbox
checkbox.checked = true;
</script>
Views
Replies
Total Likes
In the mean time my colleague found the solution.
New code:
<script>
window.addEventListener('lpRuntimeReady',function(e) {
init(e.detail)
});
function init(lpRuntime) {
console.log('check unsubscribe checkbox');
document.getElementsByName('acr-form-checkbox-4')[0].checked = true;
}
</script>
Views
Likes
Replies