How to have custom ajax commands on element using InvokeCommand
These are some examples you can try:

$response-&gt;addCommand(new \Drupal\Core\Ajax\InvokeCommand('.message', 'addClass', array('show')));
$response-&gt;addCommand(new \Drupal\Core\Ajax\InvokeCommand('.message', 'removeClass', array('show')));
$response-&gt;addCommand(new \Drupal\Core\Ajax\InvokeCommand('.message', 'attr', array('value', '123')));
$response-&gt;addCommand(new \Drupal\Core\Ajax\HtmlCommand('.message', "Show this text"));
$response-&gt;addCommand(new \Drupal\Core\Ajax\InvokeCommand('.message', 'css', array('background', '#dff0d8')));


Peace.