My latest project involves a page filled with divs, each containing specific text content. Located at the top of the page are buttons that enable filtering of the displayed divs based on their data-category. For instance, I have arranged divs showcasing all schools within a school district, categorized by grade levels. By clicking the 'Show High Schools' button, only the high school divs become visible below.
While the filtering feature functions as intended, I am looking to enhance the user experience by setting up links that automatically click the appropriate category upon navigating to the page from another source. I am aware of how to set up an auto-click for a single button upon page load, but my goal is to automatically click a button based on a specific category. For example, on my homepage, I have buttons labeled 'High Schools', 'Middle Schools', and 'Elementary Schools'. When a user selects 'Middle Schools', they are directed to the filtering page where only middle schools are displayed. The user can then use a 'Show All' button to reset the filter if desired.
Live Link
Although the filtering mechanism is fully functional, I am seeking guidance on how to implement links that direct users to the page with an automatic button click based on the selected category.