How to replace character in jquery?

Total Post:88

 1280  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.

  1. Post:194

    Re: How to replace character in jquery?

    try this code:

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

      Modified On Apr-05-2018 06:40:34 AM