• Hi, I would like for this button not to open a new page, but disappear when pressed and have a paragraph with some text appear at its place – how can I make this?

    For some other links, I will want a contact form to appear at the place of the button rather than the text paragraph.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    It’d be easier if it weren’t an actual link, but just a plain HTML element styled to look like a button. But if it has to be a link you can prevent the link from executing with event.preventDefault().

    The simplest approach is to include the hidden paragraph or form on the page, but have it be initially hidden with CSS display: none;. Add an event listener to the button element. Code associated with the listener would alter the CSS styling to make the hidden content visible. Here is but one of many examples of how this can be accomplished.

Viewing 1 replies (of 1 total)
  • The topic ‘Button to make text or form appear?’ is closed to new replies.