I want to access HTML elements in typescript using FormcontrolName.
I can able to access html element using ID of elements
For example :
var element = document.getElementById("txtID")
But can we access the element using FormControl (without use of ID)
Use QuerySelector of HTML5.
If your html input tag is like this:
<input type="text" id="txtID" formControlName="txtID" />
var element = document.querySelector("input[formControlName='txtID']");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With