Sometimes you need to add objects to a page from other sources. Like Facebook friendconnect boxes, twitter widgets, or some Google tool(s). Many times, these elements will not pass W3C validation and ruin your perfectly crafted site. To get around this problem, I use some JavaScript to simply inject these elements into my page after the DOM has rendered.
At the bottom of my site I’ve included a button to launch my Google Voice widget. This was invalidating my markup so I added this bit of code to my jQuery doc.ready to get things squared away.
1 | $("#content").append('*google voice object embed code here*'); |
My page now validates perfectly and I didn’t lose a cool feature.
