Title: Defer JavaScript breaks the layout
Last modified: October 24, 2021

---

# Defer JavaScript breaks the layout

 *  Resolved [demir16](https://wordpress.org/support/users/demir16/)
 * (@demir16)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/defer-javascript-breaks-the-layout/)
 * I set up LSCache according to my needs. Every page has custom <script> tag with
   custom JavaScript at the end of the body. These scripts change dom content dynamically.
   But if I enable defer Js, the custom js in the <script> doesn’t work, so the 
   layout spoils. When I disable it everything works fine.
 * I think the problem is about inpage scripts that produce dynamic content. All
   other layout is Ok.
 * The broken part example: [https://prnt.sc/1x8yrok](https://prnt.sc/1x8yrok)
 * [https://prnt.sc/1x8yvk4](https://prnt.sc/1x8yvk4)
 * Server: hosting ER with lites peed web server
 * PHP 8.0
    WordPress and all plugins updated
 * Report number: YRAAIGLN
 * Report date: 10/24/2021 18:09:15
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fdefer-javascript-breaks-the-layout%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  Plugin Support [qtwrk](https://wordpress.org/support/users/qtwrk/)
 * (@qtwrk)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/defer-javascript-breaks-the-layout/#post-15001590)
 * Hi,
 * then please use `Defer JS exclude` to exclude this part of JS from being deferred
 * Best regards,

Viewing 1 replies (of 1 total)

The topic ‘Defer JavaScript breaks the layout’ is closed to new replies.

 * ![](https://ps.w.org/litespeed-cache/assets/icon-256x256.png?rev=2554181)
 * [LiteSpeed Cache](https://wordpress.org/plugins/litespeed-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/litespeed-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/litespeed-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/litespeed-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/litespeed-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/litespeed-cache/reviews/)

## Tags

 * [defer](https://wordpress.org/support/topic-tag/defer/)
 * [javascript](https://wordpress.org/support/topic-tag/javascript/)

 * 1 reply
 * 2 participants
 * Last reply from: [qtwrk](https://wordpress.org/support/users/qtwrk/)
 * Last activity: [4 years, 7 months ago](https://wordpress.org/support/topic/defer-javascript-breaks-the-layout/#post-15001590)
 * Status: resolved