I'm using Google maps to generate different locations off of a variable I'm passing in. However, I get an error from the API saying it cannot find the address and I think I know why. It's because I have a <br/>
tag for the variable that is being outputted.
So for example when I alert the variable that's being passed through, it looks like this:
Deep Forest<br/>
Suite 233<br/>
100 Top Lane<br/>
Los Angeles, CA
But I want the outputted variable to look like this.
Deep Forest Suite 233 100 Top Lane Los Angeles, CA
In short, I just want to replace all instances of <br/>
with a empty space. I have all my different location variables laid out like this.
Here is what I tried:
var content = ("cookie.current.addressLabel"); // this outputs the current location address which is Deep Forest<br/>Suite 233<br/>100 Top Lane<br/>Los Angeles, CA
var text = $(content).text();
//showGoogleMap(content);
var regPat = /<br\s*[\/]?>/gi;
` tags in there so you can replace them you need to use `.html()` – Rob M. May 08 '17 at 18:34