2
I’m racking my brain here for a solution whose is to pass function names as parameters to be executed.
I have the function ShowModal
in which its goal is to call other functions and objects. How can the name of the function to execute it.
$.showModal = function (idModal,idInputHidden,idNome,nameFunction,idOptional) {
$(idModal).modal('show');
if(idOptional == 'null'){
$.setField(idInputHidden,idNome,idOptional);
}else{
$.nameFunction(idInputHidden,idNome);
}
};
// Exemplo de uso Normal dela
$.showModal($('#myModalProduto'),$('#produto_modal_ctrl_id_key'),$('#produto_modal_ctrl_id'),'setFieldModalProduto',null);
//No Modal do Produto tenho a seguinte função setFieldModalProduto
$.setFieldModalProduto = function (a,b) {
field1 = $(a);
field2 = $(b);
};
For me I’m not very clear.
– Jose Edinaldo
Pass the function itself on the call, much more practical.
– Bacco