[Support request] Add Javascript To Button ?

Home Forums Support [Support request] Add Javascript To Button ?

Home Forums Support Add Javascript To Button ?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #2219722
    Jason

    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?

    #2219831
    Leo
    Staff
    Customer Support
    #2219917
    Jason

    Hi Leo –

    Thank you for your feedback.

    If I understand correctly, I would add a data attribute and drop the Java there?

    #2220009
    David
    Staff
    Customer Support

    Hi 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.

    #2222268
    Jason

    The 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="10098">DOWNLOAD THE CHECKLIST</a>

    The error is what prompted me to reach out.

    #2222309
    David
    Staff
    Customer Support

    The editor won’t allow edits to a Blocks HTML – as it has to be validated.
    And to add the data- 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.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.