ExecJS::ProgramError: SyntaxError: Reserved word “function”

前端 未结 3 1592
醉酒成梦
醉酒成梦 2021-01-07 16:49

In our rails rfq.js.coffee, we only have a simple js code:

$(function() {
  $(\'#need_report\').change(function(){
    if ($(this).val() == true) {
      $(\         


        
3条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-07 16:55

    You can't use standard JS like that in a Coffeescript file. Either rename the file to rfq.js, or convert it to coffeescript:

    $ ->
      $('#need_report').change ->
        if $(this).val()
          $('#report_language').hide()
    

提交回复
热议问题