14 lines
342 B
JavaScript
14 lines
342 B
JavaScript
|
window.onload = function(evt) {
|
||
|
var form = document.getElementById('form');
|
||
|
form.addEventListener('submit', function () {
|
||
|
for (var input of form.getElementsByTagName('input')) {
|
||
|
if (input.name === '') {
|
||
|
input.name = input.id
|
||
|
}
|
||
|
if (input.name && !input.value) {
|
||
|
input.name = '';
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
}
|