The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Quoting, editing problems

3 posters

Go down

Pro Admin Quoting, editing problems

Post by Zzbaivong Thu 25 Jun - 12:52

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.
Zzbaivong
Zzbaivong
Forumember

Posts : 101
Reputation : 51
Language : JavaScript ^^

http://devs.forumvi.com

Back to top Go down

Pro Admin Re: Quoting, editing problems

Post by SLGray Fri 26 Jun - 2:11

Do you exactly need those in the code?


Quoting, editing problems Slgray10

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

Male Posts : 51554
Reputation : 3524
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Pro Admin Re: Quoting, editing problems

Post by Zzbaivong Fri 26 Jun - 3:18

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

Posts : 101
Reputation : 51
Language : JavaScript ^^

http://devs.forumvi.com

Back to top Go down

Pro Admin Re: Quoting, editing problems

Post by SLGray Sat 27 Jun - 2:25

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


Quoting, editing problems Slgray10

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

Male Posts : 51554
Reputation : 3524
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Pro Admin Re: Quoting, editing problems

Post by Zzbaivong Sat 27 Jun - 8:44

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.
Zzbaivong
Zzbaivong
Forumember

Posts : 101
Reputation : 51
Language : JavaScript ^^

http://devs.forumvi.com

Back to top Go down

Pro Admin Re: Quoting, editing problems

Post by Ange Tuteur Sat 27 Jun - 8:57

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" />';
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Pro Admin Re: Quoting, editing problems

Post by Zzbaivong Sat 27 Jun - 9:01

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

Posts : 101
Reputation : 51
Language : JavaScript ^^

http://devs.forumvi.com

Back to top Go down

Pro Admin Re: Quoting, editing problems

Post by Ange Tuteur Sat 27 Jun - 10:01

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.';
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Pro Admin Re: Quoting, editing problems

Post by Zzbaivong Sat 27 Jun - 10:02

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.';
Zzbaivong
Zzbaivong
Forumember

Posts : 101
Reputation : 51
Language : JavaScript ^^

http://devs.forumvi.com

Back to top Go down

Pro Admin Re: Quoting, editing problems

Post by Ange Tuteur Sat 27 Jun - 10:02

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

Male Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Back to top

- Similar topics

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