[Plugin: Welcome Pack] Getting js error on the email admin
-
Hi!
I just downloaded the plugin and tried it out on my site. I get a js error saying that jq is not defined. I rewrote the js to this
(function($) { $(document).ready( function() { $('.if-js-closed').removeClass('if-js-closed').addClass('closed'); if (-1 === window.location.search.indexOf('tab=emails')) postboxes.add_postbox_toggles('buddypress_page_welcome-pack'); else postboxes.add_postbox_toggles('buddypress_page_welcome-pack-emails'); $('div.initially-hidden').each( function() { $(this).hide(); }); $('#dpw-admin-metaboxes-general input').click( function() { var button = $(this); var config = $('div.setting-' + button.attr('class')); if ( 1 == button.attr('value') ) config.css('background-color', 'rgb(255,255,224)').slideDown('fast').animate( { backgroundColor: 'rgb(255,255,255)' }, 1600); else config.stop(true).slideUp(); }); $('#emailpicker').change( function() { var index = this.selectedIndex; if ( 0 == index ) { $('#email').hide().empty(); return; } $.post( ajaxurl, { action: 'dpw_fetch_email', 'cookie': encodeURIComponent(document.cookie), '_wpnonce': $("#_ajax_nonce_dpw_emails").val(), 'id': index }, function(response) { if ( response[0] + response[1] == '-1' ) return; $('#email').html(response.substr(0, response.length-1)).show(); }); }); }); })(jQuery);
and that works. Unless jq was intended as something different than a shorthand for jQuery then the self execution wrapper is the recommended way of doing things.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘[Plugin: Welcome Pack] Getting js error on the email admin’ is closed to new replies.