I would like to know if and how you can pass a jquery command as function's parameter
var childs = ["#foo", "#bar"];
loopTheChilds("trigger('change')");
loopTheChilds("prop( 'disabled', true )");
var loopTheChilds = function ( operation ) {
$.each ( childs, function ( idx, val ) {
$( val )[operation]();
});
}
My gol would be to obtain this
$( "#foo" ).trigger("change");
$( "#bar" ).trigger("change");
// or
$( "#foo" ).prop( 'disabled', true );
$( "#bar" ).prop( 'disabled', true );
Or know how to get the same result in any other way.
Thanks