Object has no method 'apply'
<p>I am creating a few DOM elements dynamically like,</p>

<pre><code>var anchorElement = jQuery('&lt;a /&gt;',{text:property.text});
var liElement = jQuery('&lt;li /&gt;',{"class":"navlink_"+i,id:"navlink_"+i});
anchorElement.on('click',property.fnctn);
liElement.append(anchorElement);
parentID.append(liElement);
</code></pre>

<p>Where <code>property</code> is a JSON object.
<code>property.text</code> is the text that I want to put into anchor element. (Works fine)</p>

<p>I want to attach a click event handler to that anchor element.
The function that needs to be bound to that element is specified in JSON and we can access it like</p>

<pre><code>property.fnctn
</code></pre>

<p>The following line should bind the event handler to the anchor element.</p>

<pre><code>anchorElement.on('click',property.fnctn);
</code></pre>

<p>This was not working so I tried converting it into string like,</p>

<pre><code>anchorElement.on('click',property.fnctn.toString());
</code></pre>

<p>No Success...</p>

<p>When I click on this link, the error is logged in the console</p>

<p>The object  has no method 'apply'.
What is the reason...???</p>

<p>I am able to get it working with a slight work around like </p>

<pre><code>anchorElement.attr('onclick',property.fnctn+"()");
</code></pre>

<p>Above statement works, but I want to know why <code>.on()</code> API is not working.</p>

<p>Thanks :)
AÐitya.</p>
