I'm trying to style a Google Maps InfoWindow. For each of my map markers I have a window that works perfectly on a local site and in a JSFiddle. However, when I add the code to a Drupal block, it strips the closing div tags.
I've tried this way:
`var message =
"<div class='window-container'>" +
"<div class='window-content'>" +
"<div class='window-header'>" +
"<div class='window-title'>" + name + "</div>" +
"<div class='window-subtitle'>" + org + "</div>" +
"</div>" +
"<div class='window-body'>" + summary + "...</div>" +
"</div>" +
"</div>";`
And this way:
`var message =
'<div class="window-container">\
<div class="window-content">\
<div class="window-header">\
<div class="window-title">' +name+ '</div>\
<div class="window-subtitle">' +org+ '</div>\
</div>\
<div class="window-body">' +summary+ '</div>\
</div>\
</div>';`
And this way with a Babel compiler:
`var message = '
<div class="window-container">
<div class="window-content">
<div class="window-header">
<div class="window-title">${name}</div>
<div class="window-subtitle">${org}</div>
</div>
<div class="window-body">${summary}</div>
</div>
</div>'`
And on the page, in my console, it always comes out like this!
`var message =
"<div class='window-container'>" +
"<div class='window-content'>" +
"<div class='window-header'>" +
"<div class='window-title'>" + name + "" +
"<div class='window-subtitle'>" + org + "" +
"" +
"<div class='window-body'>" + summary + "..." +
"" +
"";`
It removes all the closing div tags! Why?
If you paste your code into ckeditor or other filters you'll have some trouble like that.
So it's recommanded to create a custom block programmatically, like explained here : https://drupal.stackexchange.com/questions/183499/how-to-create-a-new-block-programmatically
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.