Streaming live at 10am (PST)

(SOLVED) How to remove a specific part of a text from the html page?


#1

Hi there :slight_smile:

I am experiencing a little UI issue… I am dynamically generating link buttons pulling their url and text from the link field of a collection list. Everything works like a charm, except people, nowadays, do not need to see the https:// that the webflow link field is forcing me to use.

Would there a be a way, to artificially remoce the “https://” part on DOM is ready for example through jQuery or plain javaScript ?

Have a nice weekend you all ! :hugs:


#2

well, turns out I found the answer mayself through stackoverflow !
Here is the code I used and tweeked for my need:

<!--remove http://-->
<script>
// wait for DOM to be ready
$( document ).ready(function() {
	$('.text-block-7').text(function (_, old){
  	return old.replace('http://', '');
	});
});
</script>

Now I’d just have one more question, how could I do the same to remove https aswell instead of just the http ? I mean in one piece of clean script, is that possible ?