5
$("#btn_submit").click(function(){
    alertify.prompt("Please enter note/remarks for this Form:", function (e, value) {
        $("#alertify-ok").val('Submit Form'); //change button text
            if (e) {
                alertify.success("Form has been submitted");
            } else {
                alertify.error("Your form is not submitted");
            }
        });

警告提示对话框的 HTML

<button id="alertify-ok" class="alertify-button alertify-button-ok" type="submit">
    OK
</button>

当用户单击提交按钮时出现提示。尝试使用下面更改按钮文本但它不起作用

$("#alertify-ok").val('Submit Form'); //change button text

小提琴- 我需要将默认OK按钮文本更改为其他内容

如何将按钮文本更改为Submit Form而不是默认值OK

4

2 回答 2

13

<button>innerText有财产没有value。利用.text()

$("#alertify-ok").text('Submit Form'); //change button text

使用.set('labels')选项更改默认文本。

alertify.prompt('Please enter your comments', 'some value', 
    function(evt, value){ alertify.message('You entered: ' + value);}
).set('labels', {ok:'Submit', cancel:'Cancel'});

小提琴

于 2015-06-29T12:24:10.400 回答
1

发现这个:alertify

alertify.prompt('Please enter your comments', 'some value', 
    function(evt, value){ alertify.message('You entered: ' + value);}
).set('labels', {ok:'Submit Form', cancel:'New Cancel'});
于 2015-06-29T12:37:24.003 回答