Help inserting richtext/simple editor into javascript variable
Hello there.
Im at the moment developing a site where i am using google maps api v3 and im trying to make it posible for the content editor to edit the content of an InfoWindow google.maps.InfoWindow with a richtext/simple editor my problem is when i insert the pagefield to the javascript variable controling the content of the InfoWindow, the content of the richtext editor is something like this <strong>Header</strong>Address field<a href="#">link</a> and i use the insert <br /> at linebreaks but when i insert the pagefield into my JavaScript code like this
the data retrieved from the pagefield named infoWindow breaks out on more lines so the javascript code fails. i can fix this when adding \ to the end of all lines in the editor in the content section of umbraco. but this isn't optimal for the content editor if he wants to have tables/divs/other html stuff or something when he is editing the infowindows throughout the site.
Result getting atm(here it breaks the lines of output from the pagefield):
Help inserting richtext/simple editor into javascript variable
Hello there.
Im at the moment developing a site where i am using google maps api v3 and im trying to make it posible for the content editor to edit the content of an InfoWindow
google.maps.InfoWindowwith a richtext/simple editor my problem is when i insert the pagefield to the javascript variable controling the content of the InfoWindow, the content of the richtext editor is something like this<strong>Header</strong>Address field<a href="#">link</a>and i use the insert<br />at linebreaks but when i insert the pagefield into my JavaScript code like thisthe data retrieved from the pagefield named infoWindow breaks out on more lines so the javascript code fails. i can fix this when adding
\to the end of all lines in the editor in the content section of umbraco. but this isn't optimal for the content editor if he wants to have tables/divs/other html stuff or something when he is editing the infowindows throughout the site.Result getting atm(here it breaks the lines of output from the pagefield):
wanted result for no javascript error(the html is retrieved in on line of code without line breaks that javascript cant handle):
hope you understand my problem. and that somebody have a solution for this problem.
Can't you use a function to remove the line breaks ?
any suggestions for how that function should be created i've tried to wrap it inside a javascript function which gives the same issue.
the posted javascript code breaks up like this when inserting it in a javascript function
results in
and if i set it on a onload it like this
results in
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.