Title: JavaScript error when cookie message contains newlines / single quotes
Last modified: August 14, 2019

---

# JavaScript error when cookie message contains newlines / single quotes

 *  Resolved [Dan Mossop](https://wordpress.org/support/users/danmossop/)
 * (@danmossop)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/javascript-error-when-cookie-message-contains-newlines-single-quotes/)
 * Hey guys,
 * Great work on the plugin. Just came across a minor bug.
 * When the “Customizer > Divi Cookie Consent > Content > Cookie Message” box contains
   a newline or single quote, the resulting JavaScript is broken and triggers an“
   Uncaught SyntaxError: Unexpected identifier” error in the console and prevents
   the consent box from displaying.
 * I believe the issue lies with this line in the DCC_Markup class:
 * `"message": '<?php echo $dcc_content; ?>',`
 * And seems to be fixed by changing it to:
 * `"message": <?php echo json_encode($dcc_content); ?>,`
 * Hope that is of use.
    Dan

The topic ‘JavaScript error when cookie message contains newlines / single quotes’
is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/cookie-consent-for-divi_cbae85.svg)
 * [Divi Cookie Consent for GDPR](https://wordpress.org/plugins/cookie-consent-for-divi/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cookie-consent-for-divi/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cookie-consent-for-divi/)
 * [Active Topics](https://wordpress.org/support/plugin/cookie-consent-for-divi/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cookie-consent-for-divi/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cookie-consent-for-divi/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [Dan Mossop](https://wordpress.org/support/users/danmossop/)
 * Last activity: [6 years, 10 months ago](https://wordpress.org/support/topic/javascript-error-when-cookie-message-contains-newlines-single-quotes/)
 * Status: resolved