How to create a function for the checkbox?

How to make it so that when the checkbox was noted that there is an additional input, and when the tick was removed, this input has disappeared?
July 4th 19 at 23:13
2 answers
July 4th 19 at 23:15
input[type="checkbox"] + input[type="text"] {
 display: none;

input[type="checkbox"]:checked + input[type="text"] {
 display: inline;
July 4th 19 at 23:17

Find more questions by tags CSSHTMLJavaScriptjQuery