Skip Navigation

[Resolved] Styling the parent’s parent of checked checkbox

This thread is resolved. Here is a description of the problem and solution.

Problem:

I am trying to style the parent's parent of a checked checkbox in AJAX search form.

Solution:

You can try the "js_event_wpv_parametric_search_results_updated" JS event, like this:

https://toolset.com/forums/topic/styling-the-parents-parent-of-checked-checkbox/#post-2103503

Relevant Documentation:

100% of people find this useful.

This support ticket is created 3 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 3 replies, has 2 voices.

Last updated by robertC-18 3 years, 5 months ago.

Assisted by: Luo Yang.

Author
Posts
#2096987

Tell us what you are trying to do? I am trying to style the parent's parent of a checked checkbox.

Is there any documentation that you are following? I am following this support ticket from 2014: https://toolset.com/forums/topic/label-styling-of-checked-checkbox/ but it doesn't seem to be working for me. Admittedly I am awful at Javascript / jQuery so I'm probably doing something wrong that's incredibly obvious to you!

I have added this code to the JS editor of the Search and Pagination section in the view:
jQuery( function active_label(){
$('input[checked=checked]').parent().parent().addClass('active');
});

Is there a similar example that we can see? Not to my knowledge.

What is the link to your site? The page where I'm expecting the results to be is here: hidden link

#2097561

Hello,

There isn't such kind of built-in feature within Toolset plugins, it needs custom codes, and I have checked the URL you mentioned above, there are some JS errors in your website:

Uncaught TypeError: $ is not a function

Since it is a custom codes problem, please share your website credentials in below private message box, I need to test and debug it in a live website, thanks

#2103503

Thanks for the details, I have done below modifications in your website:
Edit the post view:
hidden link
modify the custom JS codes to:

jQuery( document ).on( 'js_event_wpv_parametric_search_results_updated', function( event, data ) {
	/**
	* data.view_unique_id (string) The View unique ID hash
	* data.layout (object) The jQuery object for the View layout wrapper
	*/
	jQuery('input[checked=checked]').parent().parent().addClass('active');
	
});

Please check if it is what you want, thanks

#2103933

My issue is resolved now. Thank you so much! You helped me immensely!!