Using icon to start onclick

User 2531231 Photo


Registered User
19 posts

Hi All,
I need to click on an icon to initiate a javascript.
So I added an icon-link, but can't figure out how to make it onclick rather than href.
If I were writing the HTML it would be a snap, but I want to do it in SD3.
Appreciate any suggestions.
Jim Baker
User 122279 Photo


Senior Advisor
14,454 posts
Online Now

Which framework are you using in SD3?
Ha en riktig god dag!
Inger, Norway

My work in progress:
Components for Site Designer and the HTML Editor: https://mock-up.coffeecup.com


User 2531231 Photo


Registered User
19 posts

Hi Inger,
Using Vanilla, Mobile first.

So I don't think I can grab any "ready-made" component.
When I started this, I had it in mind to make a button-link or icon-link and just change the href to onclick.
When I found out that wasn't easy, I started trying to find another way to do it.
So far, no luck.

Thanks,
Jim Baker




User 122279 Photo


Senior Advisor
14,454 posts
Online Now

Oh dear, Vanilla is new to us all, and to my knowledge CC haven't provided any support articles yet. You may be lucky and get a reply from someone who has found out how to do what you want, but my guess is, that we're all waiting for the documentation and some components to appear.

If you could be bothered to change to either Foundation or Bootstrap, you will find a lot of people who can help. Or contact CC support directly and let them help you.
Ha en riktig god dag!
Inger, Norway

My work in progress:
Components for Site Designer and the HTML Editor: https://mock-up.coffeecup.com


User 2903050 Photo


Registered User
260 posts

From my understanding vanilla has no pre-set classes like say Foundation or bootstrap. It's like a blank canvas.
So basically you are free to create exactly what you want from scratch.
In my opinion it would be like coding from scratch on a blank sheet but without the coding part. Hope I am correct.
Regards Phil
User 122279 Photo


Senior Advisor
14,454 posts
Online Now

If I'm correct, this has to be done with some attribute. Vanilla has a list of attributes, but none of them seems to be anything like onclick.
Or is it so, that you can use Foundation and Bootstrap classes/attributes and just import the css and js files? I'm not really keen on fumbling around in the dark here, I wish we had some more information about this...
Ha en riktig god dag!
Inger, Norway

My work in progress:
Components for Site Designer and the HTML Editor: https://mock-up.coffeecup.com


User 379556 Photo


Registered User
1,535 posts

Is it perhaps possible to use onclick as an attribute for the icon (Attributes section of the Elements panel, using Custom)? I haven't tried it, but it might be worth experimenting with it.

Frank
User 2531231 Photo


Registered User
19 posts

Alright folks,
Thanks for thinking.
I'm going to keep "stumbling in the dark" for awhile longer, just out of stubbornness.
If I come up with anything I'll post, otherwise maybe somebody else will think of something.
Jim Baker
User 122279 Photo


Senior Advisor
14,454 posts
Online Now

Frank Cook wrote:
Is it perhaps possible to use onclick as an attribute for the icon (Attributes section of the Elements panel, using Custom)? I haven't tried it, but it might be worth experimenting with it.

Frank


That sounds very likely, I was also looking at that Custom attribute, but I didn't know what to set as the value.
Ha en riktig god dag!
Inger, Norway

My work in progress:
Components for Site Designer and the HTML Editor: https://mock-up.coffeecup.com


User 379556 Photo


Registered User
1,535 posts

Inger wrote:
I didn't know what to set as the value.

Might it be the function name of the javascript (as here)? Thus the name would be onclick, and the value would be myfunction(). I'm afraid my ignorance of Javascript is extensive.

Frank

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.