Closed kntmrkm closed 10 years ago
Hello. I'm using this great JS lib in Rails app.
I want to catch callback event in below code,
in app/assets/javascripts/form.js
$(function() { $('input').on('ifToggled', function(event){ console.log("test"); }); });
and, I discribed initial code below.
in app/assets/javascripts/init-icheck.js
$(function() { init_icheck(); $(document).on('ready page:change', init_icheck); }); init_icheck = function(){ $('input').iCheck({ checkboxClass: 'icheckbox_square-green', radioClass: 'iradio_square-green' }); };
I could confirm callback working finally. but, It's working when delete below part.
$(document).on('ready page:change', init_icheck);
above code initialize callback function? if not delete above part. "ifToggled" event doesn't work.
but, my app(Rails) need initializing iCheck when change a page. How do I should fix my code?
Enviroment is below.
sorry, my english.
thank you.
sorry guys.
problem cause this part.
$(function() { init_icheck(); $(document).on('ready page:change', init_icheck); });
no need init_icheck();. initializing process duplicated. maybe.
init_icheck();
Hello. I'm using this great JS lib in Rails app.
I want to catch callback event in below code,
in app/assets/javascripts/form.js
and, I discribed initial code below.
in app/assets/javascripts/init-icheck.js
I could confirm callback working finally. but, It's working when delete below part.
in app/assets/javascripts/init-icheck.js
above code initialize callback function? if not delete above part. "ifToggled" event doesn't work.
but, my app(Rails) need initializing iCheck when change a page. How do I should fix my code?
Enviroment is below.
sorry, my english.
thank you.