From 6b767b4b8d2fded33281e6fc52e049b9b7a390bf Mon Sep 17 00:00:00 2001 From: Alex Roberts Date: Mon, 31 Oct 2011 11:05:54 -0700 Subject: [PATCH] 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". --- js/jquery.mobile.forms.button.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/js/jquery.mobile.forms.button.js b/js/jquery.mobile.forms.button.js index 19ccbcf7..861996ab 100644 --- a/js/jquery.mobile.forms.button.js +++ b/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() ); } });