Styled <select> in css. There was a problem, which is that the default is the first option (it says "Select the desired item"). But the user must necessarily choose some other than him.
And when sending data to the server, if the user did not select other items, incorrect data is sent (some of the other items must be necessary).
How to restrict the user so that before pressing the button to send data to the server, it is checked whether he chooses some other item, or left the default one. I tried using the js - onclick function on the send button, but the data is still sent.
function ValidateSelect(selected) { var kindSelect = selected.value; var valid = false; if (kindSelect == "Выберите алгоритм") { selected.value = ""; return false; } else { return true; break; } } <select class="turnintodropdown" name="algoritm" id="algoritm" required> <option>Выберите алгоритм</option> <option value="AES">AES</option> <option value="Rijndael">Rijndael</option> <option value="TripleDES">TripleDES</option> </select> <br /> <p> <div class="col-md-offset-2 col-md-10"> <input type="submit" value="Зашифровать" onclick="ValidateSelect(algoritm)" class="btn btn-default" /> </div> </p>