Output HTML only on individual post view

If you want to load your js only on page/post view you can do it like this:

function myplugin_enqueue_scripts() {
    global $wp_query;
    if ( $wp_query->is_single ) {
        wp_enqueue_script( 'my_js', ... );
    }
}
add_action( 'wp_enqueue_scripts', 'myplugin_enqueue_scripts' );