Replacing backslash (\) in JQuery -
i have problem replacing backslash text in jquery. have next variable:
var = []; a[0] = "\ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\ x......................................x\ x.xxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxx.x\ x......................................x\ "
i'm using code replace backslash, doesn't work.
<script> a[0] = a[0].replace(/\\/g, "fsdf"); document.write(a[0]); </script>
what wrong?
a backslash followed newline allows compose long strings on multiple lines without having close , reopen string enclosure; resulting string concatenation (i.e. without newlines):
var = 'hello\ world'; console.log(a); > helloworld
if want backslashes in final string, add together them (and escape them too):
var = 'hello\\\ world'; console.log(a); > hello\world
jquery
No comments:
Post a Comment