From 0e936c622ed0c79000893935af4df66395bd4faf Mon Sep 17 00:00:00 2001 From: Matt Vickers <matt@envexlabs.com> Date: Thu, 24 Nov 2011 13:25:26 -0600 Subject: [PATCH 1/2] Allows the use of bootstrap-buttons.js on submit buttons. --- js/bootstrap-buttons.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/bootstrap-buttons.js b/js/bootstrap-buttons.js index ba52f1c06b..9b312cd700 100644 --- a/js/bootstrap-buttons.js +++ b/js/bootstrap-buttons.js @@ -27,9 +27,9 @@ , data = $el.data() state = state + 'Text' - data.resetText || $el.data('resetText', $el.html()) + data.resetText || $el.data('resetText', $el[ $el.is('input') ? 'val' : 'html' ]() ) - $el.html( data[state] || $.fn.button.defaults[state] ) + $el[ $el.is('input') ? 'val' : 'html' ]( data[state] || $.fn.button.defaults[state] ) setTimeout(function () { state == 'loadingText' ? -- GitLab From cdadebd7aa3146afba934b91de6bc7e10caac222 Mon Sep 17 00:00:00 2001 From: Matt Vickers <matt@envexlabs.com> Date: Thu, 24 Nov 2011 14:05:30 -0600 Subject: [PATCH 2/2] Added the input_type variable, that holds the if statement, instead of calling it twice. --- js/bootstrap-buttons.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/js/bootstrap-buttons.js b/js/bootstrap-buttons.js index 9b312cd700..bee3f99339 100644 --- a/js/bootstrap-buttons.js +++ b/js/bootstrap-buttons.js @@ -25,11 +25,12 @@ var d = 'disabled' , $el = $(el) , data = $el.data() + , input_type = $el.is('input') ? 'val' : 'html' state = state + 'Text' - data.resetText || $el.data('resetText', $el[ $el.is('input') ? 'val' : 'html' ]() ) + data.resetText || $el.data('resetText', $el[ input_type ]() ) - $el[ $el.is('input') ? 'val' : 'html' ]( data[state] || $.fn.button.defaults[state] ) + $el[ input_type ]( data[state] || $.fn.button.defaults[state] ) setTimeout(function () { state == 'loadingText' ? -- GitLab