Write function as a string in javascript
<p>I would like to create a context driven menu. This menu comes when the user clicks on any of the nodes in the tree. Each node has a class "treedropdownmenu". On node clicked, the context driven menu should open up. I am passing a method "_deleteClick" with the Delete menu option. But it is throwing me an error : "_deleteClick" menu not found.</p>

<p>I have following fine of code in my widget : </p>

<pre><code>$(".treedropdownmenu").live("click", function (event) {
    var pos;
    if(($(window).height() - event.pageY) &lt; 80) {
        pos = {
            left: event.pageX + 20,
            top: event.pageY - 60
        };
    } else {
        pos = {
            left: event.pageX + 20,
            top: event.pageY + 20
        };
    }
    if(ko.dataFor(this).nodeId() &amp;&amp; ko.dataFor(this).nodeId() !== 0) {
        var item = ko.dataFor(this);
        var strHtml = "&lt;a href='#' onclick='_deleteClick(item)'&gt;Delete:&lt;/a&gt; " + "&lt;br/&gt;" + "&lt;b&gt;Create Date:&lt;/b&gt;" + "&lt;br/&gt;" + "&lt;b&gt;Exposed Party Name:&lt;/b&gt;" + "&lt;br/&gt;" + "&lt;b&gt;Portfolio Type:&lt;/b&gt;" + "&lt;br/&gt;" + "&lt;b&gt;Owner:&lt;/b&gt;";
        $("#dataManagerMenuItem1234").show().offset(pos).html(strHtml);
    }
});
</code></pre>

<p>The delete menu I have is  : </p>

<pre><code>function _deleteClick(item) {
    alert("delete clicked");
}
</code></pre>

<p>Can anyone let me know where am I going wrong?</p>
