Firefox handles it fine, but Safari and IE7 silently fail and do not insert the element.
<script type='text/javascript'> var ul = document.getElementById('xg_navigation').getElementsByTagName('ul')[0]; ul.innerHTML = '<li id='xg_tab_home' class='xg_subtab'><a href='http://somedomain.com/'>Some Text</a></li>' + ul.innerHTML; </script>
This is with an exisitng html structure like:
<div id='xg_navigation'> <ul> <li><a href='...'>Foo</a></li> ... </ul> </div>
I dont have control over the HTML, but I do have the ability to insert a snippet of javascript in the page body.
Sadly I appear to be poorly educated on cross browser javascript support. Do I need to hook it it up via an onPageLoad sort of event somehow?
Seems like you are manipulating the DOM before it has been loaded, try adding that snippet of code inside the
window.onloadlistener: