Opening a dialog on click

hi folks,
i am new at JS and jQuery. so i had this dialog


<script>
    $(function() {
        $("#dialog" ).dialog({autoOpen:false})
        $('#tos').click(function() {
            $('#dialog').dialog('open');
        });
    });
</script>

and when i click on link. it doesn’t open

<a href="#" onclick="tos">Terms of Services |</a> 

where am i going wrong?

The script is attaching the onclick to the tag with id=“tos”

you don’t need any onclick= in the HTML as you already have it in the JavaScript.