Adding javascript trigger to user role selection on the user-edit page

You can use jQuery or plain javascript to add event listener to the role select element. E.g. jQuery(document).on(‘ready’, function(){ jQuery(‘select#role’).on(‘change’, function(){ // some if statement here alert(‘Role changed’); }); }); To add this to your admin you can either use admin_enqueue_scripts or admin_footer hooks. To enqueue script file, function my_admin_enqueue_scripts( $hook_suffix ) { if ( …

Read more

Multiple Conditional Controllers

Yes – it looks like the variables you intended to create are just being reassigned each call. You should scope the variables to to the function using var before each: var conditions, toggleControl; // here. conditions = condition_toggled.split(‘,’); toggleControl = function toggleControl(value) { conditions.forEach(function(condition) { var cond_display_control, controllers; // here. //this will get the condition …

Read more