- This topic has 9 replies, 3 voices, and was last updated 1 year, 8 months ago by David.
-
AuthorPosts
-
May 14, 2022 at 12:52 pm #2219722Jason
A 3rd party contact form plugin allows me to use this code to trigger a pop up:
< a href = “void (0) ” >Yes! I Want This!
How do I insert this code inside a Generate press button?
I can overwrite the button block code starting at: href=”
But I also get a block editor error, where WordPress prompts me to correct the code.
Is there a cleaner way to put this code inside a button?
May 14, 2022 at 7:49 pm #2219831LeoStaffCustomer SupportHi Jason,
I believe this should help:
https://wordpress.org/support/topic/adding-javascript-attributes-to-buttons/#post-13313670Let me know 🙂
May 15, 2022 at 12:39 am #2219917JasonHi Leo –
Thank you for your feedback.
If I understand correctly, I would add a data attribute and drop the Java there?
May 15, 2022 at 4:38 am #2220009DavidStaffCustomer SupportHi there,
which plugin are you using that wants the
void(0)
href ? And is there a page of its documentation where it states that?We can then advise on the best option.
May 17, 2022 at 5:47 am #2222268JasonThe plugin is from the email marketing company Birdsend.
The Birdsend plugin provides a text link to trigger an opt-in pop-up. The text link works, without error. Here is the code:
<a href="javascript:void(0)" data-birsend-form="100AAA">DOWNLOAD THE CHECKLIST</a>
My goal is to insert the code into the GeneratePress theme button style. This is what I attempted, which works – but also gives me a block error warning:
<a class="gb-button gb-button-c93da5fe gb-button-text button-effect" href="javascript:void(0)" data-birsend-form="100AAA">DOWNLOAD THE CHECKLIST</a>
The error is what prompted me to reach out.
May 17, 2022 at 6:18 am #2222309DavidStaffCustomer SupportThe editor won’t allow edits to a Blocks HTML – as it has to be validated.
And to add thedata-
attribute to that block require GenerateBlocks Pro.
Its an option under the Advanced tab.Also worth checking first that adding
javascript:void(0)
to the blocks Link field is ok. You can inspect the button on the front end to see that.If you don’t use Pro then you would need to write some HTML using a HTML Block for your button. And then style it with some CSS. Let us know if you need assistance with that.
August 27, 2022 at 1:55 pm #2325760JasonI have GenerateBlocks Pro, but I’m still unsure how to install the java into a button.
<a href="javascript:void(0)" data-birdsend-form="100AAA">Yes! I Want This!</a>
If it helps this script references the Birdsend email marketing plugin installed on my site.
Again, this works perfectly as text. I just want to put that text in a button.
August 28, 2022 at 7:23 am #2326164DavidStaffCustomer SupportIf you have GB Pro then:
1. Select the GB Button.
2. In the Link field ( from the button toolbar ) add:javascript:void(0)
3. In Advanced > Add Attribute you can add the attribute:data-birdsend-form
and the value eg,100AAA
August 28, 2022 at 3:28 pm #2326615JasonThat worked! I appreciate your help. Thank you.
August 29, 2022 at 1:29 am #2326849DavidStaffCustomer SupportAwesome – glad to hear that !
-
AuthorPosts
- You must be logged in to reply to this topic.