title: change CSS within for loop
body: <p>I have the following:</p>
  
  <pre><code>function validateInput(departmentArray) {
    let isValid = true
    const array = Object.keys(departmentArray)
  
    for(let i=0; i &lt; array.length; i++) {
      keyname = array[i]
      if (departmentArray[keyname] === '') {
          const errorMsg = `Missing \'${keyname}\' on form`
          isValid = false
  
          $('#`keyname`').toggleClass('warningBox')
  
      }
    }
    return isValid
  }
  </code></pre>
  
  <p>The <code>keyname</code> that errors out due to being empty needs to be given a red box around in the HTML. I have tried</p>
  
  <pre><code>$('#`keyname`').toggleClass('warningBox')
  </code></pre>
  
  <p>and variations thereof. How do I address the keyname with JQuery to be able to change its CSS ?</p>