Div id not defined
<p>I have a from which is wrapped within div element with id "new-task". In some page, I have a div with id "create-new-task". When I click on that, I want a modal dialog for the "new-task" to show, but nothing happens. To make sure that the click() event is functioning properly, I tried showing an alert, and it works fine. </p>

<p>Here's my code:</p>

<pre><code>    $("#new-task").dialog(
        {
            autoOpen: false,
            width: 350,
            height: 300,
            modal: true,
            title: 'Add New Task',

                close: function(event, ui) {
                    // do sth when modal dialog closed 
                }
            }
        );

        $("#new-task-link").click(function(){ 
            $('#new-task').dialog('open'); 
            return false;
    });
</code></pre>

<p>When I try to alert <code>alert($("#new-task").attr('id'));</code>, it says <strong>undefined</strong>. Am I missing something here?</p>
