Alertify JS-在提示对话框上更改按钮文本

Sli*_*yyy 3 jquery alertifyjs

$("#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");
            }
        });
Run Code Online (Sandbox Code Playgroud)

用于alertify提示对话框的HTML

<button id="alertify-ok" class="alertify-button alertify-button-ok" type="submit">
    OK
</button>
Run Code Online (Sandbox Code Playgroud)

用户单击"提交"按钮时会出现提示.尝试使用下面的更改按钮文本,但它不起作用

$("#alertify-ok").val('Submit Form'); //change button text
Run Code Online (Sandbox Code Playgroud)

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

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

Sha*_*k D 9

<button>拥有innerText财产,没有value.使用.text()

$("#alertify-ok").text('Submit Form'); //change button text
Run Code Online (Sandbox Code Playgroud)

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

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

小提琴