Search code examples
jqueryhtmlxhtmljquery-gmap3

jQuery gMap 2 - Adding html to content: line


I'm using gMap on a site I'm finishing off and as an example from the gMap site I am using the following method;

    $('#map').gMap('addMarker',
    {
        latitude: 0,
        longitude: 0,
        content: 'Some HTML content'
    }
);

In the content: 'some HTML content' line I have added a line of html including an img and a div of text. Like this'

content: '<img src="img/shop.jpg" alt="shopfront" /><div id="map-text"><h2>Elan Hair Design</h2><p>17 Woodgate, Rothley,<br />Leicestershire. XXXXXXX</p><h3>T: XXXXXXXXX</h3></div>'

It all looks and works great, but when I validate under xhtml strict I get errors about adding a img and div tag in the content: '' line.

Have I mis-understood the type of html that can be added to this area? Or have I just done it wrong.

Any help would be greatly received.

Wayne


Solution

  • If you have javascript in an XHTML document the correct way to embedded it is as follows:

    <script type="text/javascript">
    /* <![CDATA[ */
    // content of your Javascript goes here
    /* ]]> */
    </script>
    

    see here for an explanation.