jquery - Single Javascript function not working in on Heroku -


i deployed rails app heroku , have found there single javascript function. function, officercheck() lives in own file officercheck.js. , called initialization file init.js line officercheck.

the function below; first output log doesn't show up

function officercheck(){     console.log("officer check in");     var change=0;     $('#toggle-two-wrapper').on('change', function(){         if(change===0){         checking();         }else{             change=0;         }     });     function checking(){         var alert=0;         var existingroles=[];         neededroles=["president", "secretary", "treasurer"];         $("select.officer_role").each(function(i,e){             existingroles[i]=$(e).val();             console.log("existing roles "+existingroles[i]);         });         $(neededroles).each(function(i,e){             if($.inarray(e,existingroles)==-1){                 alert=1;                 $('div#final-submission').prepend("<span class='warning' style='display:block'>"+e+" needed.</span>");                 $("span.warning").delay(9000).slideup("medium");             }         });         console.log("alert equals "+alert);         if(alert==1){             console.log("we're in");             change=1;             $('div.incorporation_submit #toggle-two').bootstraptoggle('off');         }     } } 

here list of i've investigated far:

  • all other javascript functions work (including called init.js)
  • the function officercheck indeed work on localhost , heroku date machine.
  • the function officercheck , respective call indeed loaded browser when i'm browsing heroku-hosted site. (i can see both in script tab in firebug).
  • the contents of function still work if cut , paste them firebug. (leading me believe heroku doesn't how i'm calling function)
  • calling function firebug officercheck(); not work.
  • however loading function in entirety firebug , calling officercheck(); work.

i'm guessing i'm pulling sloppiness heroku won't stand for. ideas thoughts or admonishments welcome.

rails apps running on heroku may need bit of work asset pipeline serve custom scripts.

you move script application.js , check runs there.

if want keep script is, see rails javascript asset missing after precompile


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -