jquery - Javascript doesn't work in first load -
i'm use jquery ui datepicker , have problem. datepicker don't work in first load. searched , try substitute document.ready windows.load, don't work :/ code is:
$(window).load(function() { alert('carregado!') $('.datepicker').datepicker({ format: 'dd/mm/yyyy', language: 'pt-br', autoclose: true}); $('#status_bar').barrating( { onselect: function(value, text) { $('#projeto_status').val(value); } }); });
i see others answers, no 1 work me. observation, project in rails 4, , use turbolinks
yes! thanks! got it!
i chance function, look:
var do_on_load = function(){ alert('carregado!') $('.datepicker').datepicker({ format: 'dd/mm/yyyy', language: 'pt-br', autoclose: true}); $('#status_bar').barrating( { onselect: function(value, text) { $('#projeto_status').val(value); } }); } $(document).ready(do_on_load) $(window).bind('page:change', do_on_load)
now, resolved!! :d
Comments
Post a Comment