Answers for "jquery div hide show not working in wordpress"

0

jquery div hide show not working in wordpress

jQuery(document).ready(function($) {
  $('#menu-links li a').click(function() {
    //fetch the class of the clicked item
    var clickedClass = $(this).attr('class');
    //reset the active class on all the buttons
    $('#menu-links li').removeClass('active');
    //update the state on the clicked button
    $(this).parent().addClass('active');
    if (clickedClass == 'all') {
      // show all our items
      $('#menu-items').children('div.col-md-4').show();
    } else {
      //hide all elements that don't share clickedClass
      $('#menu-items').children('div:not(.' + clickedClass + ')').hide();
      //show all elements that do share clickedClass
      $('#menu-items').children('div(.' + clickedClass + ')').show();
    }
    return false;
  });
});
Posted by: Guest on October-20-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language