I was able to solve this problem with using the jQuery closest method.I had to nest the button inside the container so the function would be able to return the first ancestor of that particular button element that is clicked.
$(".toggle-button").on("click", function() {
$(this).closest('.collapse-group').find('.wpsm_panel-collapse').collapse('toggle');
});
Related Posts:
- JavaScript Loading Screen while page loads
- How to make html table vertically scrollable
- jQuery if checkbox is checked
- Jquery .on(‘scroll’) not firing the event while scrolling
- How to Show External website inside another page without iFrame? [closed]
- How to get client’s IP address using JavaScript?
- Run ScrollTop with offset of element by ID
- How to remove css property in jQuery
- Form Submit jQuery does not work
- jQuery multiple events to trigger the same function
- Using jquery to get all checked checkboxes with a certain class name
- How do I remove a box-shadow effect from an element when another element is hovered?
- jQuery delay not working
- Validate form before submit jquery
- How to get a value of an element by name instead of ID
- jquery clear input default value
- How to save the state of a drag and drop jQuery UI Sortables front end layout editor?
- How to manage ajax calls and JSON in wordpress
- How to add a ” waiting” icon for an ajax in WP frontend?
- How to get the path to current theme, but from a JS file?
- How do I use WP’s jQuery
- call shortcode in javascript
- Deregister WordPress jquery on specific page
- Fire jQuery function when post edit screen loads
- Add X meta box inputs based on form at top of meta box, how to do it right?
- Execution of JavaScript on save post
- How do I pass WordPress’s get_bloginfo(‘siteurl’) to Jquery?
- How to force jQuery to load as a first script in header in frontend?
- jQuery breaking my wordpress site
- Googles jQuery: Are There Avantages to Using It?
- Create URL with parameter for JQuery toggle status
- Stop theme’s jQuery function from running
- Populating autocomplete field with custom post type
- Making the wordpress login form a jQuery dropdown
- Not sure why wp_ajax isn’t working?
- Is it necessary to enqueue jquery?
- WordPress Ajax problem with undefined url
- Use Media Uploader on Multiple Images on same page
- Intergrating agile carousel to wordpress: how to write the ajax_callback function
- How I got jQuery Quicksand working with WordPress?
- Displaying div from custom-post-type in Fancy Box
- How can I fire a jQuery event once getBlocks() actually returns the post’s blocks instead of null?
- WordPress + BlockUI or a splash page [closed]
- Return an array from get_terms and store as JavaScript array for search autocomplete
- WP http XML response HTML encoding and image display problems
- Using WP_Query to grab custom meta values, foreach to json object
- Do we have to santise html passing into Javascript ? How?
- Add/remove action on jQuery toggle
- jShowOff not showing numeric links, shows ‘undefined’ instead
- Javascript stopped working [closed]
- Why is my WordPress loading old version of JQuery?
- delete post meta by AJAX
- url – ajax loaded but no JS
- Why should I deregister jquery?
- jQuery does not work on WordPress editor
- how to json_encode(); the Loop content so that the encoded array is [“0”:content, “1”:content]
- jQuery will not work on page from snippet or file
- How to keep HTML form field that is conditional hidden with javasript hidden after page reload?
- Accessing javascript in multiple files [closed]
- Loading jquery locally
- Issues loading Jquery on WordPress website
- Script not loading when depending on jQuery
- masonry only works if jquery is called twice
- How to call custom jQuery plugins into the customizer controls
- No Object Properties sending form through AJAX
- Redirect wp_dropdown_pages() to an AJax request?
- Change zurb foundation top bar style on.scroll in wordpress theme using jquery and css
- click event to unhide something after ajax not firing
- WP_ENQUEUE not working with Foundation 5
- Save jQuery UI Sortable on WordPress
- Why does WordPress load jQuery in my header instead of footer?
- Parse wordpress blog data using json api and ajax
- Problem adding MP3 attachments to a jPlayer playlist
- JQuery Issues With WordPress Theme Interface
- wp_enqueue_script jquery and jquery ui not working
- wp_enqueue_script calling jQuery at different times for different browsers?
- AJAX calendar navigation returns -1
- Retrive username of the loged in user using jquery
- Get with jQuery the value of an ACF field
- I want to run Sql Query in script how can i do this
- jquery Autocomplete
- Homepage loads many unnecessary jquery-ui files
- How to change event in slider
- Adding scripts before plugins scripts
- Bootstrap with Flexslider jQuery Issue
- slide change on hover with nextgen scrollgallery [closed]
- How to make jQuery load AFTER plugin’s script?
- jQuery not working internal pages [duplicate]
- My .js file is getting a 404
- Contact Form 7 submission does not complete [closed]
- Unable to understand this jquery code [closed]
- how to display post in jquery slider and carousel
- Carousel Hover Image
- What is calling jquery?
- Accessing Advanced Custom Fields with Repeater using jQuery instead of PHP
- How to Add jQuery cod in wordpress [duplicate]
- can’t make jQuery work (change image on time interval) [closed]
- Fire an event after Featured Image selection
- Elementor form – checkboxes validation
- How to add input file plain text and submit to publish?