Skip to content

Commit fac2bd0

Browse files
committed
jquery .live() simple selector
1 parent b0efb6c commit fac2bd0

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/rails.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,20 +105,17 @@ jQuery(function ($) {
105105
/**
106106
* disable-with handlers
107107
*/
108-
var disable_with_input_selector = 'input[data-disable-with]';
109-
var disable_with_form_selector = 'form[data-remote]:has(' + disable_with_input_selector + ')';
110-
111-
$(disable_with_form_selector).live('ajax:before', function () {
112-
$(this).find(disable_with_input_selector).each(function () {
108+
$('form[data-remote]').live('ajax:before', function () {
109+
$(this).find('input[data-disable-with]').each(function () {
113110
var input = $(this);
114111
input.data('enable-with', input.val())
115112
.attr('value', input.attr('data-disable-with'))
116113
.attr('disabled', 'disabled');
117114
});
118115
});
119116

120-
$(disable_with_form_selector).live('ajax:after', function () {
121-
$(this).find(disable_with_input_selector).each(function () {
117+
$('form[data-remote]').live('ajax:complete', function () {
118+
$(this).find('input[data-disable-with]').each(function () {
122119
var input = $(this);
123120
input.removeAttr('disabled')
124121
.val(input.data('enable-with'));

0 commit comments

Comments
 (0)