I have some collection templates with rich text, and I would like to have all links opened in a new tab. So I read this topic.
But since, the code has changed. So I tried this in my Google Chrome console : jQuery(document).ready(function() { $('*[data-rt-link-type="external"]').attr("target", "_blank"); });
And this works wonderfully.
So then I tried to include this code inside webflow (both in general custom code, and in an embed component), but without success : <script> jQuery(document).ready(function() { $('*[data-rt-link-type="external"]').attr("target", "_blank"); }); </script>
You need to make sure that JQuery is loaded before your script tries to rely on its functions. With webflow it is automatically loaded before the </body> tag. So your script should loaded after JQuery. Meaning you need to have it placed in the template>settings>custom code> Before </body> tag - input field.
Give that a shot.
BTW: If you share your published site URL it is easy for someone to see the rendered issue and code. Can’t see that URL inside of a read only Shared Link.