Reputation: 1
I am working on WordPress Wofunnels form.I am writing code to get input with checkbox. Here is the problem. The label has been displayed but check is not getting displayed.
< script >
setTimeout(function () {
var x = document.createElement("INPUT");
x.setAttribute("type", "checkbox");
x.checked = true;
var label = document.createElement('label')
label.htmlFor = "id";
label.appendChild(document.createTextNode('Do you want to include this product?'));
document.getElementsByClassName('wfacp_order_summary_container')[0].appendChild(x);
document.getElementsByClassName('wfacp_order_summary_container')[0].appendChild(label);
}, 8000); <
/script>
https://varycare.com/checkouts/jv1/?preview_id=529&preview_nonce=d4e329e985&preview=true
Upvotes: 0
Views: 49
Reputation: 466
I have added the code in fiddle, removed the extra "<" it's working as expected.
setTimeout(function() {
var x = document.createElement("INPUT");
x.setAttribute("type", "checkbox");
x.checked = true;
var label = document.createElement('label')
label.htmlFor = "id";
label.appendChild(document.createTextNode('Do you want to include this product?'));
document.getElementsByClassName('wfacp_order_summary_container')[0].appendChild(x);
document.getElementsByClassName('wfacp_order_summary_container')[0].appendChild(label);
}, 8000);
<div class='wfacp_order_summary_container'>
</div>
https://jsfiddle.net/nishantj/rwgqkvaz/1/
Upvotes: 1