Possible Duplicate:
jquery click doesnt work on ajax generated content
The issue is that I need to perform a JQuery on click function to an <a>
tag created from an Ajax get. I can't seem to find an answer that works for me.
$("#get_button").click(function (e) {
$.ajax({
type: 'GET',
url: 'http://someurl.com/apikey=1234124124',
dataType: 'jsonp',
success: function (data) {
newRow = "<a id='some_id'>test</a>";
$("#table_id").append(newRow);
}
});
});
$('#some_id').click(function (event) {
event.preventDefault();
alert('this will pop up if it worked');
});
Edit for clarification: In my code there are multiple rows added with the id of some_id, I forgot to show that.