0

I have a function where I would like to call classList methods dynamically, something like this:

function expand(action) {
  searchContainer.classList[action]("expanded");
}
button.addEventListener("click", expand('add'), false);
searchContainer.addEventListener("onblur", expand('remove'), false);

But not sure how can I do that?

Leff
  • 1,968
  • 24
  • 97
  • 201

0 Answers0