Skip to content

Instantly share code, notes, and snippets.

@vivrichards600
Created April 3, 2019 19:26
Show Gist options
  • Save vivrichards600/7032395fe59d345d3a0163213e054fa3 to your computer and use it in GitHub Desktop.
Save vivrichards600/7032395fe59d345d3a0163213e054fa3 to your computer and use it in GitHub Desktop.
var inputs = document.querySelectorAll('input');
var labels = document.querySelectorAll('label');
for (var currentInput = 0; currentInput < inputs.length; currentInput++) {
var inputHasLabel = false;
for (var currentLabel = 0; currentLabel < labels.length; currentLabel++) {
if (labels[currentLabel].htmlFor == inputs[currentInput].id) {
inputHasLabel = true;
}
}
if (inputHasLabel == false) {
inputs[currentInput].style = inputs[currentInput].style+"; border:10px dashed red;";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment