Search code examples
javascriptjqueryprompt

Custom JS Prompt Popup


I'm looking for a way to customise the JS prompt popup so that I can give the user the options that I want them to have -

  1. Change - Take the value from the prompt box and change the value that was checked to initiate the prompt in the first place.
  2. Continue - Don't care, continue with the original value.
  3. Cancel - Forget this, just get rid of the box.

Options 1 & 3 are available by default (albeit with option 1 being called 'Ok'), but I am unaware of a way to manipulate the prompt to offer a 3rd option.

I'm guessing that this cannot be done through JS, so are there any jQuery plugins that may help me? Thanks.


Solution

  • jQuery UI has a dialog component that can be used for this.

    If you're looking for a less bloated solution, a Google Search comes up with many reusable results.