JavaScript: A BackSlash as part of the string

Posted by Abs on Stack Overflow See other posts from Stack Overflow or by Abs
Published on 2010-04-19T15:14:58Z Indexed on 2010/04/19 15:23 UTC
Read the original article Hit count: 174

Filed under:
|

Hello all,

I have a JavaScript variable that I echo out using PHP which is shown like this in the page source:

var db_1 = 'C:\this\path';

When I set the value of a text field with that variable like so:

$('#myinput').val(db_1);

The slashes have disappeared and only the other characters are left!

Why is this and how can I put the slashes back in??

Thanks all

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery