JSFiddle - React, Tailwind, and code Playground
HTML
<form>
<p>От кого</p>
<input type="form">
<p>Ваш пароль</p>
<input type="form">
<p>Повторите пароль</p>
<input type="form">
<p>Куда</p>
<select>
<option>Пермь</option>
<option>Москва</option>
</select>
<p>Сообщение:</p>
<input type="textarea">
<input type="button" value="проверить">
</form>
JavaScript
var form = document.body.children[0];
function validate (form) {
var button = document.body.form.children[10];
button.onclick(function() {
for (var i = 0; i <form.length; i++) {
if (input[i].value == undefined) {
alert("Заполните поле.");
}
}
if (input[1] !== input[2] ) {
alert("Пароли не совпадают.");
input[2] = undefined;
}
});
}