Title: JavaScript error
Last modified: August 31, 2016

---

# JavaScript error

 *  [tlvwebdevelopment](https://wordpress.org/support/users/tlvwebdevelopment/)
 * (@tlvwebdevelopment)
 * [10 years ago](https://wordpress.org/support/topic/javascript-error-97/)
 * The live preview is not working for the fonts.
 * The following fixes the bug
 * Line 57
    `preview_text = jQuery('#acfgfs-preview div').html();` should read `
   preview_text = jQuery('.acfgfs-preview div').text();`
 * Line 60
    `jQuery('#acfgfs-preview div').html(preview_text)` should read `jQuery('.
   acfgfs-preview div').text(preview_text)`
 * Cheers,
    Dan
 * [https://wordpress.org/plugins/acf-google-font-selector-field/](https://wordpress.org/plugins/acf-google-font-selector-field/)

Viewing 1 replies (of 1 total)

 *  Thread Starter [tlvwebdevelopment](https://wordpress.org/support/users/tlvwebdevelopment/)
 * (@tlvwebdevelopment)
 * [10 years ago](https://wordpress.org/support/topic/javascript-error-97/#post-7389972)
 * Actually, this is still proplematic with multiple font selectors on the same 
   page
 * this fixes it
 *     ```
       preview_text = container.find('.acfgfs-preview div').text();
         font = new_font.replace( ' ', '+' );
         container.find('.acfgfs-preview').html('<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=' + font + '"><div style="font-family:' + new_font + '"></div>');
         container.find('.acfgfs-preview div').text(preview_text);
       ```
   

Viewing 1 replies (of 1 total)

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

 * ![](https://ps.w.org/acf-google-font-selector-field/assets/icon-256x256.png?rev
   =1141057)
 * [ACF: Google Font Selector](https://wordpress.org/plugins/acf-google-font-selector-field/)
 * [Support Threads](https://wordpress.org/support/plugin/acf-google-font-selector-field/)
 * [Active Topics](https://wordpress.org/support/plugin/acf-google-font-selector-field/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/acf-google-font-selector-field/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/acf-google-font-selector-field/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [tlvwebdevelopment](https://wordpress.org/support/users/tlvwebdevelopment/)
 * Last activity: [10 years ago](https://wordpress.org/support/topic/javascript-error-97/#post-7389972)
 * Status: not resolved