Link with Javascript

Hi,

is it possible to insert a link like this ? I only want to use a text - change it in a link - and have to insert this link…

Bildschirmfoto 2023-03-15 um 14.27.53

Is there a way to implement that ?
thanks
tom

Search for something like

JavaScript link onclick href

And you’ll should find some answers :+1::wink:

2 Likes

Hi @Jannis
thanks - find a lot in google - but not sure how to do this in blocs app …

The code bric might help you.

2 Likes

Cant you add it to the URL in the sidebar? Or does Blocs stop that?

Tom, just to explain what its doing, its just running a function when clicked. Thats why “onclick” is an option here, just use the custom attributes.

1 Like

Hi @PeteSharp and @Jannis
Thanks for your answers …
I try to use the url in the sidebar. Also tried the onclick Attribut. Don’t get it to work. There are instructions what to do when the url not work - but the instructions for wordpress. I don’t try it with the html brick.
But I give it a try :+1::+1:

UPDATE

Both variations working. To insert the link on the sidebar, and also the onclick version …
The problem was Safari on my older Mac …
Firefox and chrome work well , but not Safari. On my new MacBook it also works on Safari.
Thanks

Tom

2 Likes

Hi Tom, I have the same issue (link to the js e-recht). But somehow it is not working. I want to add the onclick to a word … How did you solve it? Thanks a lot for your support.
Regards
Joerg

You could always just write the link code into the code widget.

Hi @JoeL
Sorry for the delay. You found a solution ? Or still need help ?
Tom

Hi Tom,
I still need help … I need exactly the same you did … Thanks!
Joerg

How did you apply it.

“Not working” isn’t helpful. What errors do you get in the inspector etc are steps you can take.

Hi @PeteSharp On my „update“ post I wrote that both versions working. The problem was my old safari version. But I don’t use the „onclick“ version. I insert the link in the sidebar menu.
So @JoeL you mean with the same as I did you also want to open the erecht24 cookie menu ? Just use a text ( for example: Cookie Einstellung ) and set the link. Choose in the side bar → navigate to url and insert the link …
But only this part:
“javascript:UC_UI.ShowSecondLayer();”

The best is to copy this part of the link in your admin panel and paste it inside blocs :slight_smile:
Hope that helps