1 ajax_example_advanced.inc ajax_example_advanced_commands_css_callback($form, $form_state)

Callback for 'css'.

See also

ajax_command_css()

File

modules/examples/ajax_example/ajax_example_advanced.inc, line 305
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);
}