Skip to content
This repository
Browse code

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 authored October 31, 2011

Showing 1 changed file with 5 additions and 1 deletion. Show diff stats Hide diff stats

  1. 6  js/jquery.mobile.forms.button.js
6  js/jquery.mobile.forms.button.js
@@ -79,11 +79,15 @@ $.widget( "mobile.button", $.mobile.widget, {
79 79
 	},
80 80
 
81 81
 	refresh: function() {
82  
-		if ( this.element.attr( "disabled" ) ) {
  82
+		var $el = this.element;
  83
+
  84
+		if ( $el.attr( "disabled" ) ) {
83 85
 			this.disable();
84 86
 		} else {
85 87
 			this.enable();
86 88
 		}
  89
+
  90
+		this.button.find( ".ui-btn-text" ).text( $el.text() || $el.val() );
87 91
 	}
88 92
 });
89 93
 

0 notes on commit 6b767b4

Please sign in to comment.
Something went wrong with that request. Please try again.