# Basic Phoenix example not working without Javascript

**URL:** <https://forum.elixirforum.com/t/basic-phoenix-example-not-working-without-javascript/52657>\
**Category:** Questions\
**Tags:** phoenix, accessibility\
**Created:** [December 20, 2022, 11:36am UTC](https://forum.elixirforum.com/t/basic-phoenix-example-not-working-without-javascript/52657 "2022-12-20T11:36:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajur58](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/ajur58/32/33928_2.png) [@ajur58](https://forum.elixirforum.com/u/ajur58)\
**Post date:** [December 20, 2022, 11:36am UTC](https://forum.elixirforum.com/t/basic-phoenix-example-not-working-without-javascript/52657/1 "2022-12-20T11:36:31Z")

</div>

Hi everyone, I’m new to Elixir & Phoenix and loved the experience so far. However, when looking into Phoenix it seems like the standard way to work with buttons is `<%= button "Click me" %>` , which creates a tag, and adds `data-` attributes. Then there’s an onClick listener in app.js that creates a form, injects the attributes and submits it.

I must say I’m somewhat disappointed that because of this the page doesn’t work without Javascript + I was surprised that app.js weighs 632kB uncompressed.

Is this a common problem that all Phoenix apps have? Or do people use something else? Or maybe I’m just missing something?

---

<div class="post-metadata">

**Author:** ![LostKobrakai](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/lostkobrakai/32/3072_2.png) [@LostKobrakai](https://forum.elixirforum.com/u/LostKobrakai)\
**Post date:** [December 20, 2022, 12:00pm UTC](https://forum.elixirforum.com/t/basic-phoenix-example-not-working-without-javascript/52657/2 "2022-12-20T12:00:34Z")

</div>

You could not use buttons outside of forms. Then you don’t need the JS and your website will work without JS. Also `phoenix_html.js`, which defines what you described, is tiny (\<3kB uncompressed): [phoenix\_html/priv/static/phoenix\_html.js at main · phoenixframework/phoenix\_html · GitHub](https://github.com/phoenixframework/phoenix_html/blob/master/priv/static/phoenix_html.js)

phoenix.js is much larger because it’s powering the client side part of phoenix channels. If you’re not using channels on the client you should be fine to exclude phoenix.js.

---

<div class="post-metadata">

**Author:** ![ajur58](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/ajur58/32/33928_2.png) [@ajur58](https://forum.elixirforum.com/u/ajur58)\
**Post date:** [December 21, 2022, 5:52am UTC](https://forum.elixirforum.com/t/basic-phoenix-example-not-working-without-javascript/52657/3 "2022-12-21T05:52:07Z")

</div>

Thanks for your answer and pointing me to phoenix\_html.js!

I understand that it would not work outside of forms, my suggestion would rather be to wrap the button with a form right in the template as HTML, not with JS after page load. Is there a reason why Phoenix decided to do it with JS?

This is the way some newer JS frameworks like Remix do it, getting the benefits of a progressive UX - as in everything works without JS from the first load, then it gets enhanced.

It might not be a big deal, but I believe these things could matter to other people like me who came to Phoenix after getting tired of the JS drama. T
