gibster wrote:
Perfect!
thanks
Charlie.
PS. that closing ul tag was just a typo in the post, but well spotted.
You may want to also considert using textContent for DOM 3 compliant
browsers (Mozilla et al and maybe IE one day) and innerText for IE.
That way your li can contain other markup that will be automatically
removed.
<script type="text/javascript">
function showContent( id )
{
var el = document.getElementById(id);
if ( el.textContent ){
alert(el.textContent);
} else if ( el.innerText ){
alert(el.innerText);
}
}
</script>
<ul id="theUL">
<li id="anLi1"><b>some</b> <i>text</i></li>
<li id="anLi2"><span style="color:red;">some</span> other text</li>
</ul>
<button onclick="showContent('anLi1')">anLi1</button>
<br>
<button onclick="showContent('anLi2')">anLi2</button>
--
Rob