最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

jquery - Javascript : custom text on Confirm Ok Cancel button - Stack Overflow

programmeradmin3浏览0评论

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>

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>
Share Improve this question asked Aug 24, 2013 at 16:57 AnimeshAnimesh 411 gold badge3 silver badges8 bronze badges 2
  • You can't. You'll have to create your own dialog. – bfavaretto Commented Aug 24, 2013 at 16:58
  • possible duplicate of Javascript Confirm popup Yes, No button instead of OK and Cancel – bfavaretto Commented Aug 24, 2013 at 16:59
Add a ment  | 

3 Answers 3

Reset to default 1

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.

发布评论

评论列表(0)

  1. 暂无评论