Turbolinks load event not working on with page refresh

前端 未结 3 2023
离开以前
离开以前 2020-12-19 04:11

Javascript code like this

document.addEventListener(\"turbolinks:load\", function() {
  $(\"p#hide_if_js\").hide();
});

is working fine wit

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-19 04:56

    You can use in this manner

    document.addEventListener('load turbolinks:load',function() {
    //Your code
    });
    

    equivalent coffee code

    document.addEventListener 'load turbolinks:load', ->
      #Your code
      return
    

提交回复
热议问题