Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

id always returing null angular

use hidden instead of ngif
 <div class="fv-row mb-10" [hidden]="!isMail">
     <input
      class="form-control form-control-lg form-control-solid" 
      [disabled]="suspendAcc" id="emailIdEnter" </input>
   ....
 </div>

typescript:
 const elem = document.getElementById("emailIdEnter");
    // console.log(this.card.nativeElement);

    elem?.addEventListener("keypress", (event) => {
      if (event.keyCode === 13) { // key code of the keybord key
        event.preventDefault();
        // your code to Run
        this.mailContinue();
      }
    });
 
PREVIOUS NEXT
Tagged: #id #returing #null #angular
ADD COMMENT
Topic
Name
6+5 =