如何将JavaScript命令链接到php中的表单按钮? (<DIV>)

I have a footer banner on a website that I manage and when I click hide or hide forever it called the following javascript to hide or hide forever the banner:

/**
 * Main JS File
 *
 * @author Your Inspiration Themes
 * @package YITH Footer Banner
 * @version 1.0.3
 */
jQuery(document).ready(function($) {
    if($.cookie(templateDir) == '1') {
        $(".fbanner").hide();
    }
    $("#showhidefbanner a").on('click',function(event){
        event.preventDefault();
        $('.fbanner').hide();
    });
     $("#showhideforever").on('click',function(event){
        event.preventDefault();
        $(".fbanner").hide();
        $.cookie(templateDir, '1',{ expires: 365, path: '/' });
    });
});

Until here everything ok. The problem is that when someone send the form the banner the banner keeps appearing. Therefore I want to called this javascript to never show this banner again. Here is my php code:

<?php
/**
 * Footer Banner page
 *
 * @author Your Inspiration Themes
 * @package YITH Footer Banner
 * @version 1.0.0
 */
;?>
<!-- YITH-FOOTER-BANNER -->
<div class="fbanner">
    <div id="fbannercont" class="group">
        <div id="fbannerlogo">
            <?php if (get_option('yith_fbanner_link')):?><a href="<?php echo get_option('yith_fbanner_link');?>" title="<?php echo get_option('yith_fbanner_message');?>"><?php endif;?>
                <img src="<?php echo get_option('yith_fbanner_image');?>" alt="<?php echo get_option('yith_fbanner_message');?>"/>
            <?php if (get_option('yith_fbanner_link')):?></a><?php endif;?>
        </div>
        <ul id="fbannermess">
            <li>
                <h3>
                    <?php if (get_option('yith_fbanner_link')):?><a href="<?php echo get_option('yith_fbanner_link');?>" title="<?php echo get_option('yith_fbanner_message');?>"><?php endif;?>
                        <?php echo get_option('yith_fbanner_message');?>
                    <?php if (get_option('yith_fbanner_link')):?></a><?php endif;?>
                </h3>
            </li>
            <li>
                <p>
                    <?php if (get_option('yith_fbanner_link')):?><a href="<?php echo get_option('yith_fbanner_link');?>" title="<?php echo get_option('yith_fbanner_message');?>"><?php endif;?>
                        <?php echo get_option('yith_fbanner_sub_message');?>
                    <?php if (get_option('yith_fbanner_link')):?></a><?php endif;?>
                </p>
            </li>
        </ul>
        <div id="fbannernews">
            <?php if ( get_option('yith_fbanner_enable_newsletter_form') == true ): ?>
                <form method="<?php echo get_option('yith_fbanner_newsletter_method') ?>" action="<?php echo _e (get_option('yith_fbanner_newsletter_action') ,'yit');?>" class="fbannernewsletter">
<input type="hidden" name="form_id" value="147265" />
                <input type="hidden" name="encoding" value="" />                    
<fieldset>
                            <?php if(get_option('yith_fbanner_newsletter_name_label')){?>
                                <ul class="newsfields">
                                    <li class="newstop">
                                        <input type="text" name="<?php echo get_option('yith_fbanner_newsletter_name_name') ?>" id="<?php echo get_option('yith_fbanner_newsletter_name_name') ?>" class="name-field text-field" placeholder="<?php echo get_option('yith_fbanner_newsletter_name_label') ?>" />
                                    </li>
                                    <li class="newsbottom">
                                        <input type="text" name="<?php echo get_option('yith_fbanner_newsletter_email_name') ?>" id="<?php echo get_option('yith_fbanner_newsletter_email_name') ?>" class="email-field text-field" placeholder="<?php echo get_option('yith_fbanner_newsletter_email_label') ?>" />
                                    </li>
                                </ul>
                            <input type="submit" value="<?php echo get_option('yith_fbanner_newsletter_submit_label') ?>" class="submit-field newssubmit" />
                            <?php } else { ?>
                            <input type="text" name="<?php echo get_option('yith_fbanner_newsletter_email_name') ?>" id="<?php echo get_option('yith_fbanner_newsletter_email_name') ?>" class="email-field text-field" placeholder="<?php echo get_option('yith_fbanner_newsletter_email_label') ?>" />
                            <input type="submit" value="<?php echo get_option('yith_fbanner_newsletter_submit_label') ?>" class="submit-field" />
                        <?php };?>
                            <?php $hiddenfields = get_option('yith_fbanner_newsletter_hidden_fields');
                                if ($hiddenfields) :
                                $result = explode('&',$hiddenfields);
                                foreach ($result as $hivalue ) :
                                $formvalue = explode('=',$hivalue);?>
                                    <input type="hidden" id="<?php echo $formvalue[0] ?>" name="<?php echo $formvalue[0] ?>" value="<?php echo $formvalue[1] ?>" />
                                <?php endforeach; endif;?>
                    </fieldset>
                </form>
            <?php endif; ?>
        </div>
    </div><!-- fbannercont -->

    <ul class="hiderzone">
        <li>
            <div id="showhideforever">
                <a href="#" title="<?php _e( get_option('yith_fbanner_hide_forever_message') ,'yit');?>">
                    <?php echo _e( get_option('yith_fbanner_hide_forever_message') ,'yit');?>
                </a>
            </div>
        </li>
        <li>
            <div id="showhidefbanner">
                <a href="#" title="<?php _e( get_option('yith_fbanner_hide_message') ,'yit');?>">
                    <?php _e( get_option('yith_fbanner_hide_message') ,'yit');?>
                </a>
            </div>
        </li>
    </ul>
</div><!-- fbanner -->
<!-- YITH-FOOTER-BANNER -->

Does anyone know how to solve this problem? Thanks in advance

Try to create a js function and call the function after send your form:

<script>    
function showHideBannerFix() {
    $(".fbanner").hide();
    $.cookie(templateDir, '1',{ expires: 365, path: '/' });
}
</script>

And in your php that the form was submited to:

echo '<script>showHideBannerFix();</script>';

I didn't test it, but i think its right.