If the selected tag has visibility: hidden, is its value represented in the submit form?

If you applied visibility: hidden to a select tag, are its values ​​represented when submitting the form?

CSS example:

 .my-select { visibility: hidden; } 

HTML example:

 <select class="my-select"> <option value="volvo">Volvo</option> <option value="saab">Saab</option> <option value="mercedes">Mercedes</option> <option value="audi">Audi</option> </select> 
+6
source share
2 answers

Yes.

visibility: hidden; will hide the element, but use the space that it would otherwise be accepted. It is still turned on and therefore its data is still sent.

and

display: none; will hide the element completely (space and all). It is still turned on and therefore its data is still sent.

You (currently) cannot disable through CSS, but you can through Javascript or JQuery. CSS is for styling, not function.

How to disable form fields using CSS?

You can style disabled fields: http://www.w3schools.com/cssref/sel_disabled.asp

+5
source

Yes, he is represented.

+2
source

Source: https://habr.com/ru/post/983079/


All Articles