WordPress.org

Ready to get started?Download WordPress

Forums

Javascript Alert Button (2 posts)

  1. devdpetrov
    Member
    Posted 1 year ago #

    Hello all,

    I'm not a very savvy programmer - amateur at best.

    My site runs the WP-Avatar theme, and I'm trying to implement this functionality that when a user click on a button on this specific page, a JavaScript alert box pops-up prompting them of something. Once they click Ok, the button would redirect them to another page.

    I have toiled on this for hours, but still can't get it to work.

    I would be incredibly grateful if someone can extend a helping hand.

    Thanks in advance!

  2. alieneila
    Member
    Posted 1 year ago #

    Ok, you're using a button right? as in... <input type="submit"... or <button>My Button</button>

    To either one you could add onClick="javascript: alert('The content here');" But that may not be exactly what you're looking for.

    <input type="submit" onClick="javascript: alert('The content here');" />

    <button onClick="javascript: alert('The content here');">My Button</button>

    or there are various other ways to do it depending exactly on your needs.

Topic Closed

This topic has been closed to new replies.

About this Topic