Add paragraph in wp-login page with jquery

Solution:

Use the following steps to make sure your custom code works:

  1. Create a javascript file in your theme directory or in a sub-directory in the root directory of your theme, and call it, let’s say, your_custom_js_code.js.
  2. Then, use an action hook called login_enqueue_scripts to enqueue/load your javascript files onto the right page at the right moment. (i.e wp-login.php)
  3. Then enqueue/load jquery onto the page.
  4. And finally, enqueue/load your custom code onto the page.

1- Your custom jquery code: (This code goes into your javascript file)

jQuery(document).ready($ => {
  $('#nav').after('<p>some text</p>');
});

2, 3, 4- Use login_enqueue_scripts action hook to load both jquery and your custom jquery file onto the right page at the right moment: (This code goes into the functions.php of your theme)

Note, that i’ve created your_custom_js_code.js in a sub-folder in my theme root directory called js. So the path to that file would be get_theme_file_uri('/js/your_custom_js_code.js'). If you decide to create your custom javascript file elsewhere, then feel free to change the path, used in the following snippet, accordingly.

add_action("login_enqueue_scripts", "your_custom_jquery");

function your_custom_jquery()
{
  wp_enqueue_script('jquery');
  wp_enqueue_script('your-custom-jquery-code', get_theme_file_uri('/js/your_custom_js_code.js'), 'JQuery', microtime(), TRUE);
}

Let me know if you were able to get it to work!