Webflow sync, pageviews & more.
NEW

In Webflow, how can I hide specific elements in the footer (such as "Ramin Khaze The Difference" and "Schedule showing") when the URL contains a certain parameter, such as "?mls"? I am a beginner in coding and would appreciate any help. Thank you!

TL;DR
  • Assign a unique class (e.g., hide-for-mls) to the footer elements you want hidden.
  • Add a JavaScript snippet in your page or project footer code that checks for ?mls in the URL and hides elements with that class.

1. Overview

Problem: You want to hide footer elements (like “Ramin Khaze The Difference” and “Schedule showing”) when the URL contains a specific parameter (e.g., “?mls”).
Solution: Use custom JavaScript added in Webflow’s custom code area that checks the URL for the parameter and then hides the targeted elements—after assigning them unique classes (or IDs) in the Designer.

2. Prepare Your Elements in Webflow

Add Custom Classes:

  • In the Webflow Designer, select each footer element you want to hide.
  • Give them a unique class name (for example, assign the class “hide-on-mls” to both elements).

3. Add Custom JavaScript Code

Locate Custom Code Section:

  • In your Webflow Dashboard, go to the page’s Settings or Project Settings.

  • Navigate to the “Custom Code” section and find the area labeled “Before tag.”
    Insert the JavaScript:

  • Add the following inline JavaScript code (ensure you wrap the code within standard

Tip: Ensure there are no syntax errors and that your class names in the code match those you set in the Designer.

4. Publish and Test

Publish Your Site: After saving the changes, publish your site.
Test the Functionality:

  • Load your published site with a URL ending in “?mls” (for example, https://yoursite.com/page?mls) to confirm that the targeted footer elements are hidden.
  • Verify that the elements display normally when the URL does not have the “?mls” parameter.

Summary

Assign a unique class to your footer elements in Webflow, then add a custom JavaScript snippet in your site’s custom code area to check for the “?mls” parameter and hide those elements accordingly. This process ensures a targeted change based on the URL.

Rate this answer

Other Webflow Questions