I want to add attr DIV on one of the list according to the values in UL LI as below.
<ul id="menu">
<li><a href="about.html">About</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
I hope I can add to the list About
, but failed.
I use the code like this:
<script type='text/javascript'>
$(function() {
$('#menu li').html("About").attr("id","active")
});
</script>
But it did not work. There is a solution?