E
E
Evtera2020-04-19 20:08:18
JavaScript
Evtera, 2020-04-19 20:08:18

Why doesn't if else work with .text?

The function only fires once, but the else block doesn't work anymore. What is the problem?

$(".column__continue-read").click(() => {
  if ($(event.target).text("Continue reading")) {
    $(event.target).text("Close");
  } else {
    $(event.target).text("Сontinue reading");
  }
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
Tigran Abrahamyan, 2020-04-19
@Evtera

You are eventnot transmitting.
$(".column__continue-read").click((event) => {

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question