How should I replace jQuery UI dialog? I try to use jQuery UI dialog.
Based on this, I put this in a node:  

&lt;script src="https://code.jquery.com/jquery-1.12.4.js"&gt;&lt;/script&gt;
&lt;script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"&gt;&lt;/script&gt;
&lt;script&gt;
    $( function() {
      $( "#dialog" ).dialog();
    } );
&lt;/script&gt;
&lt;div id="dialog" title="Basic dialog"&gt;
    &lt;p&gt;
        This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.
    &lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;
    Some stuff...
&lt;/p&gt;


And it works! The popup window shows up automatically when the node is displayed.
But I noticed that jQuery is deprecated in Drupal 8.
So, how should I do the same thing in a more "Drupal" way?

[EDIT] Making progress...
@leymannx Using the 1rst example of Ajax Dialog Boxes page you provided, I get this working (see the screen capture).
My next step: how to have the dialog box displayed automatically when the page is reached without having to click the link?
jQuery hasn't been deprecated. Some unused jQuery UI components have been deprecated in 8.8 and will be removed in Drupal 9.0. core/jquery.ui.dialog is not among them.


[8.8 issue] Deprecate unused jQuery UI components in favour of a suite of contrib modules
[8.8 change record] Deprecated unused jQuery UI asset libraries
[9.0 issue] Remove deprecated jQuery UI components and fork remaining source code into core
[9.0 change record] jQuery UI source added to Drupal core and deprecated code removed


Nonetheless there's the new Dialog API. For that you have to require the core/drupal.dialog library or the core/drupal.dialog.ajax library for more advanced stuff. Some examples can be found in the docs on Ajax Dialog Boxes. The following sample requires the core/drupal.dialog.ajax library.


  This link opens /node/1 in a modal dialog box:

&lt;a class="use-ajax" 
    data-dialog-options="{&amp;quot;width&amp;quot;:400}" 
    data-dialog-type="modal" 
    href="/node/1"&gt;
    First node displayed in modal dialog.
&lt;/a&gt;



What you currently do in your code sample hasn't much to do with Drupal at all. To do it the Drupal way check the docs on adding JS/CSS to your module or theme first. You could attach the library simply to your theme or directly to all nodes of a given type for example.


Adding stylesheets (CSS) and JavaScript (JS) to a Drupal 8 module
Adding stylesheets (CSS) and JavaScript (JS) to a Drupal 8 theme