Update form button text on refresh.

Allows submit button values to change dynamically, and update accordingly in the UI. Such as in the event a button should read "Update" instead of "Save".
This commit is contained in:
Alex Roberts 2011-10-31 11:05:54 -07:00
parent 1c3a4c7a84
commit 6b767b4b8d

View file

@ -79,11 +79,15 @@ $.widget( "mobile.button", $.mobile.widget, {
},
refresh: function() {
if ( this.element.attr( "disabled" ) ) {
var $el = this.element;
if ( $el.attr( "disabled" ) ) {
this.disable();
} else {
this.enable();
}
this.button.find( ".ui-btn-text" ).text( $el.text() || $el.val() );
}
});