Show/Hide Editor fields
Show/Hide Editor fields
Hi there,
I dont know if it is too late and I miss anything crucial? I want to show/hide specific editor fields when the user changes a certain dropdown field in editor.
The code is working but only for one time? The console.log(id) looks good and gets called but the hide and show function does only work on the first change?
The code is inside editor.on('initCreate'
editor.hide( 'queen.mother');
$(editor.field( 'mother_action' ).node()).on('change', function () {
var id = editor.field( 'mother_action' ).val();
if (id === 1){
editor.hide('queen.mother');
editor.show('queen.mother_id');
//editor.field('queen.mother').hide();
//editor.field('queen.mother_id').show();
console.log(id);
} else {
editor.show('queen.mother');
editor.hide('queen.mother_id');
//editor.field('queen.mother').show();
//editor.field('queen.mother_id').hide();
console.log(id);
}
});
Cheers
Hannes
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi,
moved it inside
editor.on('open' ....
There it works.
Cheers
Hannes
Good to hear you've got it working - thanks for posting back!
Allan