Title: Bug: Javascript Error Null Checkbox
Last modified: March 4, 2025

---

# Bug: Javascript Error Null Checkbox

 *  [denspad](https://wordpress.org/support/users/denspad/)
 * (@denspad)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/bug-javascript-error-null-checkbox/)
 * Wonder if other users have noticed an error in the console log on their site.
   Debugging another issue we found that CF7 was generating the following error 
   from within the index.js script.
   Uncaught TypeError: a is null
 * Investigation shows that the error is generated from within the following block
   of code:
   e.querySelectorAll(‘.wpcf7-acceptance’).forEach((e) => {if (!t || e.
   classList.contains(‘optional’)) return;const a = e.querySelector(‘input[type=”
   checkbox”]’);((e.classList.contains(‘invert’) && a.checked) ||(!e.classList.contains(‘
   invert’) && !a.checked)) &&(t = !1);}),It would appear the code is looking for
   the input checkbox HTML element as a direct descendant of the .wpcf7-acceptance
   span element to see if it is checked. However the HTML for the page shows that
   the input checkbox is not a direct descendent of this element and is instead 
   wrapped within a <span class=”wpcf7-list-item“> element. This appears to result
   in ‘a’ returning null in the code above.

The topic ‘Bug: Javascript Error Null Checkbox’ is closed to new replies.

 * ![](https://ps.w.org/contact-form-7/assets/icon.svg?rev=2339255)
 * [Contact Form 7](https://wordpress.org/plugins/contact-form-7/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contact-form-7/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contact-form-7/)
 * [Active Topics](https://wordpress.org/support/plugin/contact-form-7/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contact-form-7/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contact-form-7/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [denspad](https://wordpress.org/support/users/denspad/)
 * Last activity: [1 year, 3 months ago](https://wordpress.org/support/topic/bug-javascript-error-null-checkbox/)
 * Status: not a support question