WordPress.org

Ready to get started?Download WordPress

Forums

MailChimp Widget
escaping semicolons in scripts (1 post)

  1. rdmoore1000
    Member
    Posted 1 year ago #

    In the following script files:

    scrollTo.js
    mailchimp.js

    There is a semicolon at the beginning

    ;(function($) {

    and

    ;(function(d) {

    respectively. I understand the purpose of doing this is to avoid concatenation to preceding scripts or with your preceding ajax call. However, it is causing conflict with other plugins. I am not sure why, but I think it is related to a jQuery shortcut conflict.

    Besides, you should probably use wrap your code in:

    jQuery(document).ready(function($) {
    // $() will work as an alias for jQuery() inside of this function
    });

    since there is no reason to have your code running before DOM is ready. (unless the user can fill out your form really really fast)

    here is the wordpress standards:
    http://codex.wordpress.org/Function_Reference/wp_enqueue_script#jQuery_noConflict_wrappers

    If everybody uses these, we'll all be fine.

    I spent hours looking for the dreaded ';'. With debugging software, I haven't had to do that for about 15 years. Usually it was because it was missing, but not in this case ;o)

    The plugin it conflicted with was superfish, and one of my own.

    http://wordpress.org/extend/plugins/mailchimp-widget/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags