Title: Bug in Javascript that causes images not to load.
Last modified: January 16, 2019

---

# Bug in Javascript that causes images not to load.

 *  [tino1b2be](https://wordpress.org/support/users/tino1b2be/)
 * (@tino1b2be)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/bug-in-javascript/)
 * On line 106 of `kale.js`, there is the following line of code:
 *     ```
       if(jQuery(item).attr('src').match(/(https?:)?\/\/www\.youtube\.com/)) {
       ```
   
 * This code will break and cause your images not to load if there is an `<iframe
   >` without the `src` attribute. I fixed this by changing that line to this:
 *     ```
       if(jQuery(item).attr('src') != "" && jQuery(item).attr('src').match(/(https?:)?\/\/www\.youtube\.com/)) {
       ```
   
    -  This topic was modified 7 years, 4 months ago by [tino1b2be](https://wordpress.org/support/users/tino1b2be/).
    -  This topic was modified 7 years, 4 months ago by [tino1b2be](https://wordpress.org/support/users/tino1b2be/).
    -  This topic was modified 7 years, 4 months ago by [tino1b2be](https://wordpress.org/support/users/tino1b2be/).

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [jarektheme](https://wordpress.org/support/users/jarektheme/)
 * (@jarektheme)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/bug-in-javascript/#post-11099171)
 * Hi there,
 * Thank you for pointing this out. We found this bug on some pages and we’ll fix
   it as soon as possible.
 * The other way to fix it is to use this:
 * `if(jQuery(this)[0].hasAttribute("src") && jQuery(item).attr('src').match(/(https?:)?\/\/
   www\.youtube\.com/)) {`
 * Kind regards
 *  Thread Starter [tino1b2be](https://wordpress.org/support/users/tino1b2be/)
 * (@tino1b2be)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/bug-in-javascript/#post-11107933)
 * Awesome. Thank you! That’s definitely a better way of doing it, I’m not very 
   familiar with JS
    -  This reply was modified 7 years, 4 months ago by [tino1b2be](https://wordpress.org/support/users/tino1b2be/).

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Bug in Javascript that causes images not to load.’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/kale/2.8.2/screenshot.jpg)
 * Kale
 * [Support Threads](https://wordpress.org/support/theme/kale/)
 * [Active Topics](https://wordpress.org/support/theme/kale/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/kale/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/kale/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [tino1b2be](https://wordpress.org/support/users/tino1b2be/)
 * Last activity: [7 years, 4 months ago](https://wordpress.org/support/topic/bug-in-javascript/#post-11107933)
 * Status: not resolved