Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit 6b767b4b8d2fded33281e6fc52e049b9b7a390bf 1 parent 1c3a4c7
Alex Roberts mralex authored
Showing with 5 additions and 1 deletion.
  1. +5 −1 js/jquery.mobile.forms.button.js
6 js/jquery.mobile.forms.button.js
View
@@ -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() );
}
});
Please sign in to comment.
Something went wrong with that request. Please try again.