Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript: Line Break after first comma

Tags:

javascript

I have an address that is being pulled from database that interacts with Google Map API. When displaying results my address renders as follows:

456 Here Street, City, AL 36723

What would be a solution for entering a line break after

465 Here Street

So that the address would display as

456 Here Street
City, AL 36723
like image 503
SuperNinja Avatar asked Jun 26 '26 08:06

SuperNinja


1 Answers

var address = "456 Here Street, City, AL 36723";

address = address.replace(',', '<br/>');

http://jsfiddle.net/BvT9p/

like image 77
Alex Avatar answered Jun 28 '26 22:06

Alex



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!