error Uncaught Syntaxerror: Missing) after argument list

Asked

Viewed 605 times

1

I’m wanting to put a menu on my blog that’s not working CSS3 Responsive Menu Dropdown are not working!... And I think this might happen due to this error in javascript ( but as I am not sure if what is causing the problem is the error, I separated the question so as not to get confused):

Uncaught Syntaxerror: Missing) after argument list

This is the javascript

<script>
(function($) {
  $.fn.menumaker = function(options) {
    var cssmenu = $(this),
      settings = $.extend({
        format: "dropdown",
        sticky: false
      }, options);
    return this.each(function() {
      $(this).find(".button").on('click', function() {
        $(this).toggleClass('menu-opened');
        var mainmenu = $(this).next('ul');
        if (mainmenu.hasClass('open')) {
          mainmenu.slideToggle().removeClass('open');
        } else {
          mainmenu.slideToggle().addClass('open');
          if (settings.format === "dropdown") {
            mainmenu.find('ul').show();
          }
        }
      });
      cssmenu.find('li ul').parent().addClass('has-sub');
      multiTg = function() {
        cssmenu.find(".has-sub").prepend('<span class="submenu-button"></span>');
        cssmenu.find('.submenu-button').on('click', function() {
          $(this).toggleClass('submenu-opened');
          if ($(this).siblings('ul').hasClass('open')) {
            $(this).siblings('ul').removeClass('open').slideToggle();
          } else {
            $(this).siblings('ul').addClass('open').slideToggle();
          }
        });
      };
      if (settings.format === 'multitoggle') multiTg();
      else cssmenu.addClass('dropdown');
      if (settings.sticky === true) cssmenu.css('position', 'fixed');
      resizeFix = function() {
        var mediasize = 700;
        if ($(window).width() > mediasize) {
          cssmenu.find('ul').show();
        }
        if ($(window).width() &lt;= mediasize) {
          cssmenu.find('ul').hide().removeClass('open');
        }
      };
      resizeFix();
      return $(window).on('resize', resizeFix);
    });
  };
})(jQuery);

(function($) {
  $(document).ready(function() {
    $("#cssmenu").menumaker({
      format: "multitoggle"
    });
  });
})(jQuery);

</script>

And this is the part of the code related to the error:

cssmenu.find(".has-sub").prepend('<span class="submenu-button"></span>');

I researched this error, but the answers were very unique to each code... It is difficult to look at a code and know what the problem is.

blogs with the menu/error: http://95555558888899999999.blogspot.com.br/ http://menuteste158.blogspot.com.br/

Obs.: Is there any error site where you have listed several errors and your causes? It would be far too good.

1 answer

3


It is on account of this stretch in the function resizeFix where you have &lt;= in the code:

if ($(window).width() &lt;= mediasize) {
   cssmenu.find('ul').hide().removeClass('open');
}

The right thing would be:

if ($(window).width() <= mediasize) {
   cssmenu.find('ul').hide().removeClass('open');
}
  • But the blog does not accept <= so I modified it...

  • I think if I created an external javascript, it might work. I’ll try.

  • What do you mean "won’t accept"? If you’re inside a block <script>, why wouldn’t I accept?

  • because xml file does not accept.. If I leave an error message appears... The content of elements must consist of well-formed character data or markup. http://stackoverflow.com/questions/4338538/error-parsing-xhtml-the-content-of-elements-must-consist-of-well-formed-charact

  • 1

    Try to use CDATA in that code of yours, staying thus.

  • 1

    yes @Renan thanks, it was for this reason that the menu was not working, and I thought cdata was not good for anything, now worth a search in the subject... ;)

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.