Delete link not working after 1.3 upgrade (and update to phoenix_html deps)


Do I need to do something to force phoenix to use newer phoenix_html when generating app.js?


I recently upgraded from RC-2 to 1.3. My delete links stopped working. I have spent several hours troubleshooting it. This also corresponded to a change from phoenix_html 2.5 to 2.10.

I reverted to an early commit and verified the link worked before the changes.


I setup a new app using the 1.3 generator. I was able to create an html resource page in which the delete link works.

I think the issue lies with phoenix_html version. The new app uses 2.10 while the old was using 2.5. I have updated mix to use 2.10, but the generated app.js does not include the new event listener introduced around 2.10

Below is an example of the expected code from a newly generated test/comparison app. The delete link works as expected.

window.addEventListener("click", function(e) {
    var element =;

    while (element && element.getAttribute) {
      if(element.getAttribute("data-method")) {
        return false;
      } else {
        element = element.parentNode;
  }, false);

I’ve doublechecked my mix.exs file:

  defp deps do
    [{:phoenix, "~> 1.3.0"},
     {:phoenix_pubsub, "~> 1.0"},
     {:phoenix_ecto, "~> 3.2"},
     {:postgrex, ">= 0.0.0"},
     {:phoenix_html, "~> 2.10"},

and made sure that phoenix_html is before the body close:

<script src="/js/app.js"></script><iframe src="/phoenix/live_reload/frame" style="display: none;"></iframe>

But the generated app.js does not contain the new event listener as expected(and seen with the new/test app).

test app - has event listener in app.js

my app - missing the same event listener, full search of generated app.js

I don’t think the name spacing changes are causing the problem. For whatever reason, the newer phoenix-html.js is not being used in app.js. I’ve tried mix.deps get and even deleting the mix.lock file.

Any suggestions would be appreciated.

I think I had exactly the same issue. A classic JS/Node solution worked for me. I removed the generated files, removed node_modules. Then I installed all the deps again with npm install, astarted Phoenix server and it worked for me.

1 Like

I had it too. Just like @hubertlepicki wrote: rm -rf node_modules && npm install was all I needed to do.

1 Like

Thanks @hubertlepicki and @sztosz. That did the trick!!


I had some issues getting this to work on Heroku when using the buildpacks to deploy. In case anyone else encounters the problem, change phoenix_static_buildpack.config to include clean_cache=true.

Mine for reference:

1 Like