jquery .click() event not working
<p>This is my jquery code:</p>

<pre><code>$(function(){
$.post("/person/keywords/get/", function(data){
    for(i=0; i&lt;data.length; i++)
    {
        count = count + 1;
        $(".keywords-set").append('&lt;div class="keyword-item"&gt;&lt;span class="keyword" id="keyword-'+count+'"&gt;'+data[i]+'&lt;/span&gt;&lt;textarea class="comment" id="comment-'+count+'"&gt;&lt;/textarea&gt;&lt;/div&gt;');
    }
});

$(".keyword-sets").on('click', "[id^=keyword]", function(event) {
    event.preventDefault();
    alert("yes");
});
})
</code></pre>

<p>On page load, I fetch some datas from the server then append it to the html. The click event is not working for that appended html items. I'm getting this problem for all the items which I got from the server by .post() request.</p>

<p>Here is my complete and HTML and jQuery code:</p>

<p><a href="https://gist.github.com/3023937" rel="nofollow">https://gist.github.com/3023937</a></p>

<p>One more thing, I think the problem occurs bcoz of using the jQuery code inside the html(not as an external file). I'm having this similar type of code in another project where I'm having jquery code in external file and it works without any problem. Why is it so?</p>

<p>P.S. If you need any more details, I can give you.</p>

<p>Thanks!</p>
