Title: JS error
Last modified: December 12, 2022

---

# JS error

 *  [John_W_B](https://wordpress.org/support/users/john_w_b/)
 * (@john_w_b)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/js-error-144/)
 * This code
    `if ( $( '#wpseo_og_default_image' ).val().length > 0 )` causes a 
   JS error when we are not on the FB tab but the Twitter tab.
 * We can wrap the script in `if ( $( '#wpseo_og_default_image' ).length ) { ...}`
   to fix it

The topic ‘JS error’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/default-twitter-image.svg)
 * [Default Twitter Image for Yoast](https://wordpress.org/plugins/default-twitter-image/)
 * [Support Threads](https://wordpress.org/support/plugin/default-twitter-image/)
 * [Active Topics](https://wordpress.org/support/plugin/default-twitter-image/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/default-twitter-image/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/default-twitter-image/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [John_W_B](https://wordpress.org/support/users/john_w_b/)
 * Last activity: [3 years, 6 months ago](https://wordpress.org/support/topic/js-error-144/)
 * Status: not resolved