Uncaught ReferenceError: $ is not defined rails

前端 未结 7 2226
后悔当初
后悔当初 2021-01-11 11:08

I\'m trying to add Froala editor to my project.

Problem only on production server(on localhost it works fine) I\'m using rails 4.1.0 In gemfile i\'m have

<         


        
7条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-11 11:15

    Here's what I did, it worked for me:

    Surround your script with window.onload = function () { }; so your js will be executed only when the page load:

    window.onload = function () {
      $(function() {
        $('div#content').editable({
          inlineMode: false
        })
      });
    };
    

提交回复
热议问题