Click events on label element

I want to show and hide a textarea on mobile to save space. The default behaviour is for the label to focus its associated textarea.

function showHideTextarea() {
if ( == "none") { = null; //remove display: "none" and revert to initial CSS value
else {
  textarea.blur(); = "none"

function resizer() {
    if (window.matchMedia("(max-width: 766px)").matches) { = "none"
       textlabel.addEventListener("click", showHideTextarea)


I’ve not been able to get this code to work.

Do you have some associated HTML you can post?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.