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 for alertify prompt dialog

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

The prompt appears when user clicks on submit button. Tried changing button text using below but its not working

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

Fiddle- where I need to change the default OK button text to something else

How could I change the button text to Submit Form instead of default OK ?

MK.
  • 5,139
  • 1
  • 22
  • 36
Slimshadddyyy
  • 4,085
  • 5
  • 59
  • 121

2 Answers2

13

<button> has innerText property and does not have value. Use .text()

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

Use .set('labels') option to change default text.

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

Fiddle

MK.
  • 5,139
  • 1
  • 22
  • 36
Shaunak D
  • 20,588
  • 10
  • 46
  • 79
1

Found this : 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'});
Anonymous Duck
  • 2,942
  • 1
  • 12
  • 35