• Resolved albavilanova

    (@albavilanova)


    Hi,

    I am trying to show the WP Phone Message form when clicking a button and I am unable to make it work.

    My code is:

    
    <a href="javascript:;" onClick="document.getElementById('hideaway').style.display='block';">WhatsApp contact form</a>
    <div id="hideaway" style="display: none;">[wp-phone-message]</div>
    

    It does not show anything. If I write any text there, it shows up. I don’t know why…

    Could you help?

    Thank you for reading this and best regards,
    Alba

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Marcello Perri

    (@webmarcello)

    Hi Alba,

    I am very sorry for the delay, I haven’t received a notification for this message.

    I built a page on my website for your case, here is the link: https://webmarcello.co.uk/test/

    And here is the code that should fix your problem:

    
    <a id="display-shortcode" onClick="document.getElementById('hideaway').style.display='block';">WhatsApp contact form</a>
    <div id="hideaway"  >
    [wp-phone-message]
    </div>
    <style>
    #hideaway{display:none;}
    #display-shortcode{cursor: pointer;}
    </style>
    

    Be sure NOT to call the same shortcode twice in the same page, it won’t work.
    Let me know if it works

    Marcello

    Plugin Author Marcello Perri

    (@webmarcello)

    I close this case.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Show shortcode content onClick with JS’ is closed to new replies.