You can shorten your code quite a bit like this:
var func1 = function() { alert("Function 1 is called");}
var func2 = function() { alert("Function 2 is called");}
// changed property name ----------v
var myArray = [{id:"bt1", value:"+", click: func1},
{id:"bt2", value:"-", click: func2}];
$(function(){
$.each( myArray, function(i,v) {
$('<input>',$.extend({},v,{type:"button"})).appendTo('#test');
});
});
Example: http://jsfiddle.net/yLPsK/
I used the jQuery.each()[docs] method to iterate your Array.
Then I used the jQuery.extend()[docs] method to extend an empty object with the objects you created (changing func to click), as well as another one with the type:"button" info, and passed the result as the second argument to the jQuery()[docs] method.
If you add type:"button" to each object in your array, you can get rid of $.extend.
var func1 = function() { alert("Function 1 is called");}
var func2 = function() { alert("Function 2 is called");}
// changed property name ----------v
var myArray = [{id:"bt1", value:"+", click: func1, type:"button"},
{id:"bt2", value:"-", click: func2, type:"button"}];
// added the "type" property -------------------^
$(function(){
$.each( myArray, function(i,v) {
$('<input>', v).appendTo('#test');
});
});
Example: http://jsfiddle.net/yLPsK/1/