The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Quoting, editing problems

View previous topic View next topic Go down

Pro Admin Quoting, editing problems

Post by Zzbaivong on June 25th 2015, 2:52 pm

I have a code:
Code:
var jsCodes = "<img src=\"http://r29.imgfast.net/users/3412/19/22/63/smiles/45347.png\" />";
Note backslash: \"

I can preview and submit without errors. However, when I quote or edit this post, the backslash will disappear. This causes the error to my code.

To test, try quoting this post.
avatar
Zzbaivong
Forumember

Posts : 100
Reputation : 50
Language : JavaScript ^^

http://devs.forumvi.com

Back to top Go down

Pro Admin Re: Quoting, editing problems

Post by SLGray on June 26th 2015, 4:11 am

Do you exactly need those in the code?


When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.

avatar
SLGray
Administrator
Administrator

Male Posts : 41171
Reputation : 2815
Language : English
Location : United States

https://fmthemes.forumotion.com/

Back to top Go down

Pro Admin Re: Quoting, editing problems

Post by Zzbaivong on June 26th 2015, 5:18 am

@SLGray wrote:Do you exactly need those in the code?
I don't understand you. I'm reporting a problem in SCEditor.
avatar
Zzbaivong
Forumember

Posts : 100
Reputation : 50
Language : JavaScript ^^

http://devs.forumvi.com

Back to top Go down

Pro Admin Re: Quoting, editing problems

Post by SLGray on June 27th 2015, 4:25 am

I mean that I believe you do not need the backlashes?


When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.

avatar
SLGray
Administrator
Administrator

Male Posts : 41171
Reputation : 2815
Language : English
Location : United States

https://fmthemes.forumotion.com/

Back to top Go down

Pro Admin Re: Quoting, editing problems

Post by Zzbaivong on June 27th 2015, 10:44 am

I think that is not the way to solve the problem. Because my forum is also a lot of other people who also share their code.
avatar
Zzbaivong
Forumember

Posts : 100
Reputation : 50
Language : JavaScript ^^

http://devs.forumvi.com

Back to top Go down

Pro Admin Re: Quoting, editing problems

Post by Ange Tuteur on June 27th 2015, 10:57 am

The backslash "\" is commonly used in programming as an escape character. With JavaScript it can be used in string literals to use the same kind of quotation marks inside it without ending the string.

Example :
Code:
var str = 'Let's go to the park!'; // syntax error

The string ended before "s", because the quotation mark was recognized as the end of the string literal. Using the escape character gets passed this problem.
Code:
var str = 'Let\'s go to the park!'; // All good :)


Into the topic.. That's a problem, but for the moment I'd recommend using a different kind of quote for the attributes, such as the single.
Code:
var jsCodes = "<img src='http://r29.imgfast.net/users/3412/19/22/63/smiles/45347.png' />";

or swap it :
Code:
var jsCodes = '<img src="http://r29.imgfast.net/users/3412/19/22/63/smiles/45347.png" />';
avatar
Ange Tuteur
Forumaster

Male Posts : 13179
Reputation : 2884
Language : EN10, FR5
Location : Macungie, PA

http://fmdesign.forumotion.com

Back to top Go down

Pro Admin Re: Quoting, editing problems

Post by Zzbaivong on June 27th 2015, 11:01 am

I know that. Thanks for your enthusiasm.
avatar
Zzbaivong
Forumember

Posts : 100
Reputation : 50
Language : JavaScript ^^

http://devs.forumvi.com

Back to top Go down

Pro Admin Re: Quoting, editing problems

Post by Ange Tuteur on June 27th 2015, 12:01 pm

The explanation on the backslash wasn't directed towards you. Dawa

From what I can tell, the backslash in my post didn't disappear. I'm assuming it's only with certain characters ? ( i.e. double quote ) I'm just going to leave a few test below to see.

Code:
"<div id=\"noId\"></div>";
"A \"normal\" string.";

'<div id=\'noId\'></div>';
'A \'normal\' string.';
avatar
Ange Tuteur
Forumaster

Male Posts : 13179
Reputation : 2884
Language : EN10, FR5
Location : Macungie, PA

http://fmdesign.forumotion.com

Back to top Go down

Pro Admin Re: Quoting, editing problems

Post by Zzbaivong on June 27th 2015, 12:02 pm

@Ange Tuteur wrote:The explanation on the backslash wasn't directed towards you. Dawa

From what I can tell, the backslash in my post didn't disappear. I'm assuming it's only with certain characters ? ( i.e. double quote ) I'm just going to leave a few test below to see.

Code:
"<div id="noId"></div>";
"A "normal" string.";

'<div id=\'noId\'></div>';
'A \'normal\' string.';
avatar
Zzbaivong
Forumember

Posts : 100
Reputation : 50
Language : JavaScript ^^

http://devs.forumvi.com

Back to top Go down

Pro Admin Re: Quoting, editing problems

Post by Ange Tuteur on June 27th 2015, 12:02 pm

Yeah, it's only the double quote as I thought. I'll report it to see if they can do anything about it.
avatar
Ange Tuteur
Forumaster

Male Posts : 13179
Reputation : 2884
Language : EN10, FR5
Location : Macungie, PA

http://fmdesign.forumotion.com

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum