Hey,
Sorry, I’m not quite sure what you’re asking. Are you able to post a link?
Kindly,
Hannah
Hi! I will try to explain in more detail! I need to create advanced button containing a link with the JS event “onclick”. The correct link looks like this – <a href= " # " onclick=" javascript:SRC. popup_form_open(2); " >Open Form</a> . To do this, I create a button and add to the link field – "#" onclick= "javascript:EZFC. popup_form_open(2);" The button is created with the wrong link as shown on “image 1″, and the link should be created as shown on”image 2”. (the image is attached in the first post). Many plugins that can create additional buttons cope with this task, but I would like to solve this problem in Kadence Blocks. I hope you can tell me how to cope with this task with the help of Kadence Blocks.
-
This reply was modified 4 years, 8 months ago by
gnus1011.
Here are the images where I highlighted the correct and incorrect links.
img1-1 (incorrect)
img2-2 (correct)
Thank you for the detail! I’ll check with the developer and see if he has any insight around this.
Thanks for your patience!
Kindly,
Hannah
Hi,
You can’t add an onclick that way (or at all in the block settings) You are trying to break the button html markup by adding a quote to try and close out the href attribute and add in a new attribute. What you are trying to do is a hack to add an on click and that won’t work inside Gutenberg. The markup is going to be sanitized and prevent this kind of tampering.
As for a feature request to add onclick events it’s something we could consider but I would suggest doing it a different way. You are welcome to suggest and vote on features here: https://www.kadencewp.com/kadence-blocks/feature-requests/
Ben