У меня есть простая текстовая область в HTML, например:
Код: Выделить всё
Код: Выделить всё
Here is some text from the database
The problem here is that there is a specific button which appears when there is no text in the textarea. This also works as intended. This button has a function that generates text in that textarea on click. If there is text in that area, a jquery popup will appear, asking the user if he wants to override the current text. But there is no text, because I deleted it. So the popup comes, because on inspecting the element, you can still see the text, although I deleted it.
Код: Выделить всё
const $textfield = $('#sitetitle');
if ($textField.text().trim() !== '' || $textField.val().trim() !== '') {
console.log($textField.text().trim());
console.log($textField.val().trim());
overrideConfirmDialog($response, $textField, $generationButton, seoOptionPart);
} else {
$textField.text($response);
updateAllCheckFields();
}
Источник: https://stackoverflow.com/questions/781 ... eleting-it