I'm creating some elements using this code:
var itemButton = $('<button />',{'id': 'searchItemButtonId'+p[i].Id, 'class': 'itemButton', 'onclick':'javascript:alert();'}).append('Add');
The item is created with correct id and class set but the 'onclick' part doesn't work. Any ideea what is the problem here?