| 280 | |
| 281 | Object.defineProperty($input, "setError", { |
| 282 | value(message) { |
| 283 | if (!message) { |
| 284 | $errorMessage.textContent = ""; |
| 285 | okBtn.disabled = false; |
| 286 | return; |
| 287 | } |
| 288 | |
| 289 | const $parent = this.parentElement; |
| 290 | if ($input.nextElementSibling) { |
| 291 | $parent.insertBefore($errorMessage, $input.nextElementSibling); |
| 292 | } else { |
| 293 | $parent.append($errorMessage); |
| 294 | } |
| 295 | $errorMessage.textContent = message; |
| 296 | okBtn.disabled = !!message; |
| 297 | }, |
| 298 | }); |
| 299 | |
| 300 | if (onclick) $input.onclick = onclick.bind($input); |