You are here

function ajax_example_advanced_commands_css_callback in Examples for Developers 7

Callback for 'css'.

See also

ajax_command_css()

1 string reference to 'ajax_example_advanced_commands_css_callback'
ajax_example_advanced_commands in ajax_example/ajax_example_advanced.inc
Form to display the AJAX Commands.

File

ajax_example/ajax_example_advanced.inc, line 304
AJAX Commands examples.

Code

function ajax_example_advanced_commands_css_callback($form, $form_state) {
  $selector = '#css_div';
  $color = $form_state['values']['css_command_example'];
  $commands = array();
  $commands[] = ajax_command_css($selector, array(
    'background-color' => $color,
  ));
  $commands[] = ajax_command_replace("#css_status", "<div id='css_status'>Updated css_command_example to '{$color}' " . date('r') . "</div>");
  return array(
    '#type' => 'ajax',
    '#commands' => $commands,
  );
}