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,434
  • 18
  • 78
  • 163

0 Answers0