I want to activate the jQueryUI button widget on a given selector, lets say \'.button\'.
Whats the best way to automatically activate the widget on any new \'.button
Since all jquery commands have a uniform structure it is really easy to use any object (including json data from a ajax request) as a jquery command
Sample:
var jc = {
'selector': '#sample',
'method': 'dialog',
'options': {'title': 'I am a sample'}
}
$(jc.selector)[jc.method](jc.options);
is the same as
$('#sample').dialog({'title': "I am a sample}};
http://jsfiddle.net/wb5Ee/