I've added a checkbox to our form and it appears it is creating a second empty label. Any ideas how to remove that?
Solved! Go to Solution.
MktoForms2.whenRendered(function(mktoForm){
const arrayify = getSelection.call.bind([].slice);
let formEl = mktoForm.getFormElem()[0],
emptyLabels = formEl.querySelectorAll("label:empty");
arrayify(emptyLabels)
.forEach(function(label){
label.parentElement.removeChild(label);
})
});
Mainly for ADA Compliance. Screen readers can get confused seeing two labels and may grab the wrong one.
Thanks for responding. Regardless of the order in which the label is grabbed is it possible to remove that second label? I'm getting pushback from the team. They want to make sure they cover their bases for legal reasons and removing that second label would do that.
MktoForms2.whenRendered(function(mktoForm){
const arrayify = getSelection.call.bind([].slice);
let formEl = mktoForm.getFormElem()[0],
emptyLabels = formEl.querySelectorAll("label:empty");
arrayify(emptyLabels)
.forEach(function(label){
label.parentElement.removeChild(label);
})
});