Clear html on button click

Clear html on button click

script type="text/javascript">

    function clear() {
    $("#monitor").html("");
    }
 
</script>
<div>
<button onclick=clear()>Clear</button>
</div>
<hr />
<ul id="monitor">
</ul>

The monitor html does not get cleared ?????