Is it possible to create a button that is the child of an text?
Inputs can't have children because they do not end. Here's some info: https://www.w3schools.com/tags/tag_input.asp
This is not possible as input
is an inline element - it cannot have children.
This would not be a valid approach to nest HTML elements in that way. If you take a look at what jQuery plugins do, they usually wrap your <select>
element with divs and other stuff. IMHO, you can solve the problem by following a similar approach.
This will result in invalid HTML, so its not possible to do this. What you can do is create a div, which is a block element and fill it with a text box + button Inline elements.
With some styling in your CSS you can make your div look like a textbox and your textbox like a div, without borders and bevels. Resulting in something that looks like the thing you are trying to achieve here.
To get rid of the textbox look on your input use #YourTextBox {border: none;}
The correct answer is that the input
tag is a void element that cannot have any children. Inline elements such as span can have children.
Void elements only have a start tag; end tags must not be specified for void elements.
i.e. in HTML5 there can never be a closing tag for an i.e. don't use </input>
. HTML5 is not XML and it strongly discourages self-closing tags (/>
) i.e. <input />
is not strictly correct HTML5 (although it will work for compatibility purposes). The list of void element tags defined in HTML5 are: area, base, br, col, embed, hr, img, input, keygen, link, meta, param, source, track, wbr
.