google-closuregoogle-closure-library

How to add disabled attribute to an element using Google Closure?


I am trying to disable an input field using Google Closure. Can anyone tell me what is the syntax for doing that operation using Google Closure?


Solution

  • Any element on google closure can be disabled using setAttribute() function.

    /**
    * @type {Element}
    * @private
    */
    this.$title_ = null; // call getElementByClass('','') here;
    this.$title_.setAttribute('disabled', 'disabled');
    

    Here this.$title is an input element.