Search code examples
custom-elementx-tag

How to make a custom element post its value during form submit?


I'm creating a custom element that wraps a third-party control. For some reason, I have to apply this 3rd-party control on a <div> instead on an <input> or else it will behave differently.

I'm using x-tag to create the custom element.


Solution

  • You could insert a <input> tag with attribute type="hidden" and then duplicate the content of the <div> you want to post, it should work.

    As an example, you can read this other post on SO.