You’re trying to use a jQuery method, hasClass(), on a standard DOM element. You need to convert the plain JS DOM element e.target to a jQuery object, like so:
$(event.target).hasClass('textbox')
And you end up with :
$('#textbox_'+i).on('click', function(event){
if( $(event.target).hasClass('textbox')) alert('got it!');
});
Notice the use of on(), the proper closing of the click function, and you don’t need curly brackets in your if statement if you’re only executing a simple alert.