Pass Editor field name to function
Pass Editor field name to function
peterbrowne
Posts: 314Questions: 54Answers: 0
I have a $.getJSON
function used to populate a select list:
var unit_groups = [];
$.getJSON("program_data/get_unit_groups.php", function(data) {
var option = {};
$.each(data, function(i,e) {
option.label = e.text;
option.value = e.id;
unit_groups.push(option);
option = {};
});
}).done(function(){editor.field('unit_group.unit_group_pk').update(unit_groups);
});
I now want to pass the value of an Editor field to that function. The field name is program_outcome.program_outcome
How would I do that?
Answers
editor.val('program_outcome.program_outcome')
Looks like Editor is a global variable in your code anyway. So no need to pass the field value.