Adding JS to one page

Create a new dir and file dedicated to your javascript. /js/scripts.js.

Wrap your entire javascript like this:

( function( $ ) {

  var allStates = $("svg.us > *");

  allStates.on("click", function() {

    allStates.removeClass("on");
    $(this).addClass("on");

  });

} )( jQuery );

Then in your theme’s functions file, put this code. It loads your new js file.

function your_scripts() {
  wp_enqueue_script( 'your-script-handle', get_template_directory_uri() . '/js/scripts.js', array( 'jquery' ), '1.0', false );
}
add_action( 'wp_enqueue_scripts', 'your_scripts' );

That way, all your javascript is available on any page and is loaded only once (afterwards, it’s in browser cache). Since your function is on click it’s fine for it to be available on all pages.