0

I'm having an issue with a textbox display on a webform. Whenever I click the the Other option the box doesn't appear. But when it's unchecked, it appears.

option error gif link

The solution I've been trying doesn't seem to work. Any suggestions?

(function (Drupal, $) {

    'use strict';

  // display option for other in contact webform



  if ($(".checkbox").length){
document.querySelector(".checkbox").addEventListener("load", otherChecked);
  }

function otherChecked() {
    if($(".checkbox").hasClass('checked') == true) {
        console.log("it works!");
      $(".edit-submitted-what-is-it-other").css('display','block');
    }
    else {
      $(".edit-submitted-what-is-it-other").css('display','none');
    }
  }

})(Drupal, jQuery);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.