HOW TO REPLACE CHARACTER IN JQUERY?

jacob rasel

Total Post:88

Points:616
Posted by  jacob rasel
 963  View(s)
Ratings:
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. Kamlakar Singh

    Post:194

    Points:1396
    Re: How to replace character in jquery?

    try this code:

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

    var markersObj = JSON.parse(marker);

    console.log(markersObj)

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!