简体   繁体   中英

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>

You cannot change the buttons in JavaScript dialog.

But you can try This or This

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 .

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM