动态更改jQuery UI的对话框按钮文本 [英] Dynamically Changing jQuery UI dialog box Button Text

查看:504
本文介绍了动态更改jQuery UI的对话框按钮文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用jQuery的用户界面对话框,阿贾克斯的形式提交。我想改变的文字我 保存按钮等,当用户点击它,返回保存在Ajax调用完成。 PLS 帮我

I am using jQuery UI Dialog box for ajax form submit. I want change the text of my save button to wait , when user click on it and back to Save when ajax call complete. pls help me

推荐答案

你使用.dialog()方法是通过按钮选择presuming,你可以指定一个自定义类的提交按钮,然后瞄准内通过分配给该跨度类按钮文本(UI按钮文本):

Presuming you're using .dialog() with the buttons option, you can assign a custom class to the submit button, and then target the inner button text via the class that is assigned to the span (ui-button-text):

    $("#dialog-test").dialog({
        title: "My dialog",
        buttons:
            [
              {
                  text: "Submit",
                  click: function() {
                    $(".my-custom-button-class > .ui-button-text").text("Please Wait..."); 
                    $("#some-form").submit();
                  },
                  'class': 'my-custom-button-class'
              }
            ]
    });

当您保存通过提交(完成),您可以使用相同的调用文本重新设置为你想要的。

When your save completes via the submit(), you could use the same call to set the text back to what you want.

这篇关于动态更改jQuery UI的对话框按钮文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆