Like we could do something like document.getElementById('id').getAttribute('value') in normal HTML and JS on the onchange event to get the defualt value of input.
So how to achieve the same thing in LWC?
답변 7개
Ok, so you mean it is not possible to getAttribute from lightning-input elements.
handleinputchange(event) {
console.log(event.target.value);
}
The above piece works perfectly and I have used it already but it gives you the current value of that input field in context.
However HTMLElement.getAttribute('value') is used to fetch the initial value of that input.
Thank you for sharing your knowledge.