Back to all resources
URL cleaning

Remove https:// From Text Link

By Miodrag Jovanovic
This jQuery script targets all anchor (<a>) elements with a custom data attribute data-clean set to remove-http. For each of these elements, it retrieves the text within the anchor, removes any protocol (like http:, https:, or leading //), and then updates the anchor's text with the cleaned version. This is useful for displaying cleaner, protocol-independent URLs.