How to disable a button with other HTML tags inside in a form in LiveView?

For example, if I have a button which has an SVG element inside then I can not really use phx-disable-with because it will just replace the inner HTML with the string for the attribute phx-disable-with. If I don’t use that attribute then my button won’t be disabled.

How can I make it so that my button will be disabled and the inner HTML will stay the same during phx-submit event handling?

Could you add JS commands to the button to achieve what you’re after?

1 Like