Hello,

I am having coding error since my client fb_profile_image uses d'Fiens (this ' mark).

How to change my script so that the error disappears? It causes my rotary menu disappears?

http://dfiens-sewncraft.com/

 profile_image = '<div id="fb_profile_image"><img onclick="showProfileInfo(this)" data-name="d'Fiens Sew N Craft" data-first_name="d'Fiens" data-last_name="Sew N Craft" data-email="percapolkadot@gmail.com" data-url="https://www.facebook.com/app_scoped_user_id/1692543144123148/" data-about="" data-gender="female" data-location="" src="https://graph.facebook.com/1692543144123148/picture?type=normal"/></div>';
Member Avatar for diafol

Use variables for placeholders. Then no problem :)

Member Avatar for diafol

Example:

var dataName = "d'Fiens Sew N Craft";
var dataFirstName = "d'Fiens";
var dataLastName = "Sew N Craft";
var dataEmail = "percapolkadot@gmail.com";
var dataURL = "https://www.facebook.com/app_scoped_user_id/1692543144123148/";
var dataAbout = "";
var dataGender = "female";
var dataLocation = "";
var src = "https://graph.facebook.com/1692543144123148/picture?type=normal";

var profile_image = '<div id="fb_profile_image"><img onclick="showProfileInfo(this)" data-name="'+dataName+'" data-first_name="'+dataFirstName+'" data-last_name="'+dataLastName+'" data-email="'+dataEmail+'" data-url="'+dataURL+'" data-about="'+dataAbout+'" data-gender="'+dataGender+'" data-location="'+dataLocation+'" src="'+src+'" /></div>';

Else, just escape all single quotes (or apostraphes) with a backslash - easier:

var profile_image = '<div id="fb_profile_image"><img onclick="showProfileInfo(this)" data-name="d\'Fiens Sew N Craft" data-first_name="d\'Fiens" data-last_name="Sew N Craft" data-email="percapolkadot@gmail.com" data-url="https://www.facebook.com/app_scoped_user_id/1692543144123148/" data-about="" data-gender="female" data-location="" src="https://graph.facebook.com/1692543144123148/picture?type=normal"/></div>';
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.