Display a div when post has a certain tag

You could use a simple conditional and check if the post has a term using has_term():

has_term( $term, $taxonomy, $post );

Pass in your Term Slug, the taxonomy ( which sounds like you’re using post_tag and the post object, no javascript needed.

<?php if( has_term( 'term_slug', 'post_tag', $post ) : ?>

    <div>
        Show your div here!
    </div>

<?php endif; ?>

error code: 521