HTML Select and Text Input

后端 未结 3 1124
萌比男神i
萌比男神i 2021-01-15 14:28

We have all seen countless instances of forms with a select drop down having one of it\'s options as \"Other\" and on choosing that option, we get to see a input text box (w

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-15 15:33

    That's a fairly common way to design a form both on paper and on the web. I'm not quite sure exactly what you mean with a better way to do so...

    If you're worried about the hidden field not appearing if the user has javascript disabled, I'll suggest you hide the field using javascript or have a duplicate "If other please specify" text area in a noscript block:

    
    
    
    

    The backend must handle that the input in the noscript block may be missing. Or you could add the javascript version of the input to the page of the input using javascript (so both cannot possibly appear simultaniously so that they can have the same name.

提交回复
热议问题