Friends, the problem is this. There is a line:

г. тест,<br/>ул. тест д.15<br/>(бывший кирпичный завод) 

As a result, on the screen I get a line like this:

 г. тест, ул. тест д.15<br/>(бывший кирпичный завод) 

Here is my code:

  $("#partner_address").val(obj.address.replace("<br/>", "\n")); 

The question is why the .replace function replaces only the first tag found, and does not replace all the tags that are in the line? How can I fix this?

  • 3
    Write instead of "<br/>" this /<br\/>/g "<br/>" /<br\/>/g "<br/>" /<br\/>/g . - Visman
  • It worked! thank! - WhoIsDT

0