Can someone please tell me what is wrong with my plugin?

You need to redo the way you include the Javascript and CSS, or at least just the javascript.

WordPress has a way to register scripts and styles and declare their dependencies, in your case it probably isn’t working because jQuery is not loaded.

To include javascript do this within the init hook:

add_action( 'init', 'toggle_box_init' );
function toggle_box_init() {
    if ( ! is_admin() ) {
        wp_enqueue_script( 'toggle-box', plugins_url( 'toggle-box' ) . '/toggle-box.js', array( 'jquery' ) );
    }
}

The wp_enqueue_script() function takes a few arguments, the first 3 are the most important.

  1. The first argument is the handle which is essentially an ID for the script within WordPress.
  2. The second argument is the src eg. the URL of the script.
  3. The third argument is an array of dependencies. The dependencies array should contain the handles of all the scripts your own script relies on, in this case we’re using ‘jquery’ which is packaged with WordPress.

You can include your CSS using wp_enqueue_script() in the same way. I suggest reading the codex page to getter a better understanding and more examples of what you can do with it.

The reason to includes your scripts and styles this way is so that multiple plugins that rely on jquery aren’t all loading their own copy of it.