How to call jQuery functions from my form with Ajax? There is an ajax callback which occurs on change of a field in my drupal 8 form.  This populates a wrapper with information from the server.  however I also want to excecute a jquery command to make the visibility of another field be visible after that .  How can this be done? 

I tried this  $form['ajax-wrapper']['#attributes'] = array('visibility'=&gt;'initial');

but that doesnt have any effect I need to be able to run this jquery command or this javascript but dont know how to trigger it after the ajax 

document.getElementById( 'ajax-wrapper' ).style.visibility = 'initial';

           $("#ajax-wrapper").show();
You need to read the documentation as you are conflating the idea of ajax and what the AJAX capability of Form API is. A form item needs to add an #ajax item to perform ajax callbacks (php), and those functions can trigger AJAX commands some of which can trigger external JS functions.

On top of that, your actual JS code needs to conform to Drupal JS / behavior format so that it is leveraged by Drupal properly. The minimum here is it at least has to be enclosed in an anonymous function to prevent a jQuery conflict:

/**
 * @file
 */
(function ($) {

  "use strict";

  // All the JavaScript for this file.
  $("#ajax-wrapper").show();
  // other code or behaviors

})(jQuery);


Plus, if you have form fields that are dependent on other fields as far as being visible, you might be able to just use #states.

Here are resources:


https://www.drupal.org/docs/8/creating-custom-modules/adding-stylesheets-css-and-javascript-js-to-a-drupal-8-module
Behaviors
AJAX API
Ajax Forms in Drupal 8
AJAX command usage example
InvokeCommand
Form API #states
Using InvokeCommand