Home > DeveloperSection > Forums > How to replace character in jquery?
jacob rasel
jacob rasel

Total Post:88

Points:616
Posted on    October-06-2014 12:44 AM

 JQuery JavaScript  JQuery 
Ratings:


 1 Reply(s)
 668  View(s)
Rate this:
My Google Map is not reading the values from jquery thus displaying an empty div of where the markers/places should show. But when I add the values in manually from how it is read from the textbox it does display the map with all the markers. So I guessed that the "\" character is the problem. I have tried replacing it with a blank space, but it's not working.
this is code:

var marker = $('#txtMarkers').val();

var markers = marker.replace(/\\/gi, " ");

but it is not removing the "\" character. What can I do to get this right? ...I'm not used to working in javascript/jqeury and is fairly new to this, any help or suggestions will be appreciated.



Kamlakar Singh
Kamlakar Singh

Total Post:194

Points:1396
Posted on    October-06-2014 12:45 AM

try this code:

var marker = $('#txtMarkers').val();

var markersObj = JSON.parse(marker);

console.log(markersObj)


Don't want to miss updates? Please click the below button!

Follow MindStick