• Hi,

    I am using Mystique wordpress plugin and want to execute some jQuery code as below:
    Hide elements along with cookie on link click.
    I added the following code to my header.php file:

    <?php wp_enqueue_script('jquery'); ?>
    <script type="text/javascript" src="/wp-content/themes/mystique/js/jquery.cookie.js"></script>
    <script type="text/javascript" src="/wp-content/themes/mystique/js/jquery.showhide.min.js"></script>
    
    <script type="text/javascript">
    jQuery(document).ready(function($) {
    $('#ex-6').showhide({
        use_cookie: true,
        cookie_name: 'example_6'
    });
    });
    </script>

    Then added the element with id as ex-6 in the sidebar widget as:

    <p>
        <a href="#" title="Toggle the span" id="ex-6">Ads Off</a>
        <span>ABC</span>
    </p>

    You can check all the action on
    http://extreme-java.com/coding-best-practice-always-validate-method-arguments

    But clicking on that ads off link doesn’t invoke the jquery code.

    I can achieve the hide show with simple div style attribute but I need to set a cookie regarding user option for 3 days.

    Any ideas guys.

  • The topic ‘jQuery not working’ is closed to new replies.