Link to home
Start Free TrialLog in
Avatar of seopti
seopti

asked on

Insert HTML DIV in Javascript

I need to insert two divs in this javascript code but not sure how.

I would like to insert after the beggining of the script tag:

<div class="infobox-wrapper">
<div id="infobox">


And at the end:
</div></div>



<script type="text/javascript">
var poiAddress = " <?php echo $attorneysStuff['bizAddr'];?>, <?php echo $bizCity;?>, <?php echo $bizState;?>";
var poiHTML = ' <?php echo $attorneysStuff['bizName'];?><br><?php echo $attorneysStuff['bizAddr'];?>, <?php echo $attorneysStuff['bizCity'];?><br><?php echo $attorneysStuff['bizState'];?><br>Phone:<?php echo $attorneysStuff['bizPhone'];?>';
var poiZoomLevel = 12;
var infoHTML = "";

</script>

Open in new window

Avatar of leakim971
leakim971
Flag of Guadeloupe image

I think you're looking for document.write : https://developer.mozilla.org/en-US/docs/Web/API/document.write

But, today, it's not the right way to do that, it's a bit old school :)) IMHO
If you actually mean to put them inside the script tags like below, that won't work right.  The <div>s won't be recognized and will cause errors in the javascript.
<script type="text/javascript">
<div class="infobox-wrapper">
<div id="infobox">
var poiAddress = " <?php echo $attorneysStuff['bizAddr'];?>, <?php echo $bizCity;?>, <?php echo $bizState;?>";
var poiHTML = ' <?php echo $attorneysStuff['bizName'];?><br><?php echo $attorneysStuff['bizAddr'];?>, <?php echo $attorneysStuff['bizCity'];?><br><?php echo $attorneysStuff['bizState'];?><br>Phone:<?php echo $attorneysStuff['bizPhone'];?>';
var poiZoomLevel = 12;
var infoHTML = "";
</div></div>
</script>

Open in new window

Avatar of seopti
seopti

ASKER

Dave, well that's the reason I'm posting here :)
Avatar of seopti

ASKER

Javascript is a dumb programming language, not even simple DIVS are possible. I don't know who invented this shitty language.
ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial