document.addEventListener('DOMContentLoaded', function() {
// Get the search keyword from the URL
const params = new URLSearchParams(window.location.search);
const searchKeyword = params.get('search_keywords');
// Map the search term to a category
const categoryMapping = {
'italian': 'category-italian', // Replace 'category-italian' with the actual class or ID of the checkbox
'chinese': 'category-chinese', // Replace 'category-chinese' with the actual class or ID of the checkbox
// Add more mappings for other categories as needed
};
// Check if the search term matches a category
if (searchKeyword) {
const categoryClass = categoryMapping[searchKeyword.toLowerCase()];
// If a category is found, check the box
if (categoryClass) {
const checkbox = document.querySelector(`.mylisting-explore-listings-widget .${categoryClass} input[type="checkbox"]`);
if (checkbox) {
checkbox.checked = true; // Check the box
}
}
}
});