Skip to content
Browse files

add checkboxes support to jquery-ujs

  • Loading branch information...
1 parent ee275d1 commit ba5808e73111fb65e91610b078577bb014d9b6d8 @ssinghi ssinghi committed Sep 2, 2011
Showing with 5 additions and 5 deletions.
  1. +5 −5 src/rails.js
View
10 src/rails.js
@@ -52,7 +52,7 @@
linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote]',
// Select elements bound by jquery-ujs
- selectChangeSelector: 'select[data-remote]',
+ selectChangeSelector: 'select[data-remote], input[type="checkbox"][data-remote]',
// Form elements bound by jquery-ujs
formSubmitSelector: 'form',
@@ -114,15 +114,15 @@
data.push(button);
element.data('ujs:submit-button', null);
}
- } else if (element.is('select')) {
+ } else if (element.is('select') || element.is("input[type='checkbox']")) {
method = element.data('method');
url = element.data('url');
data = element.serialize();
- if (element.data('params')) data = data + "&" + element.data('params');
+ if (element.data('params')) data = data + "&" + element.data('params');
} else {
method = element.data('method');
url = element.attr('href');
- data = element.data('params') || null;
+ data = element.data('params') || null;
}
options = {
@@ -277,7 +277,7 @@
rails.handleRemote(link);
return false;
- });
+ });
$(rails.formSubmitSelector).live('submit.rails', function(e) {
var form = $(this),

0 comments on commit ba5808e

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