How to use the result of a javascript function as a phx-value for phx-click

I don’t think that is possible as JS doesn’t know to do something in that tag.

you could try phx-value-newParam="javascript:doSomethingInJs('<%= floor.number %>');"

but I highly doubt browser will execute that.

You can try setting the calculation from a function via dom yourself?

document.getElementById('specialButton').attr('phx-value-newParam', doSomething('<%= value %>'))

ps: that is a pseudo-code…

maybe look into even listeners and hooks? seems like that is gonna be useful in your case rather than the hacky code I just proposed

https://hexdocs.pm/phoenix_live_view/js-interop.html#loading-state-and-errors