Я пытаюсь очистить поля ввода после отправки формы, но только четкий текст, но мне нужно, что границы и некоторые атрибуты будут слишкомчеткие поля ввода после того, как отправить форму
// имя проверки
document.questionform.name.onchange= function() {
var name = document.questionform.name.value;
if (name === "") {
document.questionform.name.removeAttribute("class", "ready");
document.questionform.name.style.border = "1px solid #da3637";
document.getElementById("questionError").style.display = "block";
document.getElementById("questionErrorTwo").style.display = "none";
} else {
document.questionform.name.style.border = "1px solid #509d12";
document.getElementById("questionError").style.display = "none";
var pattern = new RegExp("^[а-я]+$", "i");
var isValid = this.value.search(pattern) >= 0;
if (!(isValid)) {
document.questionform.name.style.border = "1px solid #da3637";
document.getElementById("questionErrorTwo").style.display = "block";
document.questionform.name.removeAttribute("class", "ready");
} else {
document.getElementById("questionErrorTwo").style.display = "none";
document.questionform.name.style.border = "1px solid #509d12";
document.questionform.name.setAttribute("class", "ready");
}
}
};
Ajax:... $ ("# questionsave") нажмите (функция() {
var url = "questionForm.php";
$.ajax({
type: "POST",
url: url,
data: $("#questform").serialize(),
success: function(data)
{
var name = $('input[name=name]').val("");
var tel = $('input[name=phone]').val("");
document.questionform.phone.removeAttribute("class", "ready");
document.questionform.name.removeAttribute("class", "ready");
document.getElementById("questionsave").setAttribute("disabled");
document.getElementById("questionsave").style.cursor = "not-allowed";
document.getElementById("questionsave").style.opacity = "0.8";
document.questionform.name.style.borderColor = "#e4e4e6";
document.questionform.phone.style.borderColor = "#e4e4e6";
}
});
return false;
});
перезагрузки страницы после отправить? – guradio
yes после отправки, в моем коде он очищает только текст –
higlight эти как-то, который точно вызывает текст, который вы говорите, не удаляется, если эта проблема по-прежнему сохраняется – Thielicious