Convert Jquery toggle to mootools

392
November 21, 2016, at 8:12 PM

I need to convert the jquery script into a mootools 1.2.5 script.

$(document).ready(function()
{
      $('ul li').click(function(e) {
      e.preventDefault();
      $(this).children('ul').slideToggle();
      return false;
    }).children("ul").hide();
});

The Shopping Cart Software I use works only with mootools. JQuery influenced negatively mootools.

noConflict is not working.

I found this solution.

But this I can't use either because display:none; & display:block; for the UL and LI is anchored in almost every line of the whole css and that is to insane to change the whole css.

Answer 1

I understand correctly that you want to toggle the visibility of each level? Try this javascript (JSFiddle):

$$('#main li').each(function(obj, index) {
    obj.addEvent('click', function(e) {
      this.getFirst('ul').toggleClass('show');
      this.addClass('show');
      e.stopPropagation();
    });
});
READ ALSO
XHR response to Json data

XHR response to Json data

I'm writing a chrome extension for a specific site Lernu. net that generates a new DOM element when the user clicks on a word.

372
jquery ajax upload file with post

jquery ajax upload file with post

hi guys i need your help im not very good with ajax im trying to upload a image using a form with php the image is not getting to the php i got error on.

354
JQuery checkerboard

JQuery checkerboard

Here the code I came up with for the checkerboard but just need help with adding few things to the checkerboard. I know used the bind, and draggable methods but not sure on how to do that.

316