Permalink
Browse files

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".
  • Loading branch information...
1 parent 1c3a4c7 commit 6b767b4b8d2fded33281e6fc52e049b9b7a390bf @mralex mralex committed Oct 31, 2011
Showing with 5 additions and 1 deletion.
  1. +5 −1 js/jquery.mobile.forms.button.js
@@ -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() );
}
});

0 comments on commit 6b767b4

Please sign in to comment.