Animesh
Animesh

Reputation: 41

Javascript : custom text on Confirm Ok Cancel button

I have a validation where i want to show 'Continue' and 'Return' instead of OK and Cancel but I am not able to find accurate solution, can anyone help me on this.

<input type="button" name="submit" value="Submit" style="font:10px;">
                    <xsl:attribute name="onclick">
                      javascript:
                      var amount = document.getElementById('txtboxAdjustment14').value.trim();
                      if(amount == 0)
                      {
                      var cont =confirm("Have you considered amount?")
                      if (cont == true)
                      {
                      somemethod();
                      }
                      else if(cont == false)
                      {
                      return false;
                      }
                      }
                      else
                      {
                      somemethod();
                      }
                    </xsl:attribute>
                  </input>

Upvotes: 0

Views: 34617

Answers (3)

You cannot change the buttons in JavaScript dialog.

But you can try This or This

Upvotes: 1

MD Sayem Ahmed
MD Sayem Ahmed

Reputation: 29176

There's no decent cross-browser solution for doing that. I'd suggest you to use some library like jQuery UI to build a custom OK-Cancel dialog.

Check out this modal confirmation dialog.

Upvotes: 0

Kevin Bowersox
Kevin Bowersox

Reputation: 94499

You cannot change the buttons on the javascript confirm dialog. You would need to use a custom dialog implementation such as the one contained in SimpleModal.

Upvotes: 0

Related Questions