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 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.
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 June 26th 2015, 4:11 am

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 : 51576
Reputation : 3525
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 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.
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 June 27th 2015, 4:25 am

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 : 51576
Reputation : 3525
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 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.
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 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" />';
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 June 27th 2015, 11:01 am

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