• The wp_register_script that registers and older version of jquery breaks javascript in 3.4

    Removing the register fixes everything.

    add_action('wp_enqueue_scripts', 'cicb_enqueue');
    function cicb_enqueue(){
    	wp_enqueue_script('jquery');
        wp_register_script( 'zeroclipboard', WP_PLUGIN_URL . '/copy-in-clipboard/zeroclipboard.js' );
        wp_enqueue_script( 'zeroclipboard' );
    }
    
    add_action('wp_head', 'copyinclipboard', 15);
    function copyinclipboard() {
    echo '<script type="text/javaScript">
    ZeroClipboard.setMoviePath( \''. WP_PLUGIN_URL . '/copy-in-clipboard/zeroclipboard.swf\' );
    jQuery(document).ready(function() {
        jQuery(\'.copy\').mouseover(function() {
            var txt = jQuery(this).attr("title");
    		var url = jQuery(this).attr("href");
            clip = new ZeroClipboard.Client();
    		clip.setHandCursor(true);
            clip.setText(txt);
            clip.glue(this);
            clip.addEventListener(\'complete\', function(client, text) {
    			alert("The Coupon code has been copied to your clipboard." );
    			if (url!=undefined){							//this is for
    				window.location=url;						//<a href links
    			}												//to do it
            });
        });
    });
    </script>';
    }

    http://wordpress.org/extend/plugins/copy-in-clipboard/

  • The topic ‘[Plugin: Copy in clipboard] Registering jQuery breaks 3.4’ is closed to new replies.