What is the correct syntax to embed JS from Jquery UI website in Drupal 7? I'm trying to get simple JS to work on my site for testing, but having a hard time with the syntax.

The script I want to enable is simple hide script, html is:

&lt;p&gt;Click anywhere to toggle the box.&lt;/p&gt;
&lt;div id="toggle"&gt;&lt;/div&gt;


JS is:

$( document ).click(function() {
  $( "#toggle" ).toggle( "slide" );
});


Example is here:

https://api.jqueryui.com/slide-effect/

What should I put in JS file to make this work with Drupal 7?
What should I put in JS file to make this work with Drupal 7?


(function($) {
Drupal.behaviors.myBehavior = {
  attach: function (context, settings) {

    //code starts
    $( document ).click(function() {
      $( "#toggle" ).toggle( "slide" );
    });
    //code ends

  }
};
})(jQuery);


See Working with JavaScript and jQuery for in-depth info.