proper usage of jQuery.on(), and update javascript in views as well
This commit is contained in:
parent
e9e7135639
commit
33b27d2fa7
3 changed files with 11 additions and 11 deletions
|
|
@ -1,15 +1,15 @@
|
|||
- content_for :javascript do
|
||||
:javascript
|
||||
$(function() {
|
||||
$('.destroy_stock_change').live('click', function() {
|
||||
$(document).on('click', '.destroy_stock_change', function() {
|
||||
$(this).prev('input').val('1').parent().hide();
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.remove_new_stock_change').live('click', function() {
|
||||
$(document).on('click', '.remove_new_stock_change', function() {
|
||||
$(this).parent().remove();
|
||||
return false;
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
= simple_form_for [@supplier, @delivery], validate: true do |f|
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@
|
|||
var ordergroup = "#{escape_javascript(render('ordergroup'))}"
|
||||
|
||||
$(function() {
|
||||
$('a[data-remove-transaction]').live('click', function() {
|
||||
$(document).on('click', 'a[data-remove-transaction]', function() {
|
||||
$(this).parents('tr').remove();
|
||||
return false;
|
||||
});
|
||||
|
||||
$('a[data-add-transaction]').click(function() {
|
||||
$(document).on('click', 'a[data-add-transaction]', function() {
|
||||
$('#ordergroups').append(ordergroup);
|
||||
return false;
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue