I have a scenario where I am working with 4 buttons, each having a unique value. However, when I try to log the values in the console, it shows up as undefined.
Here is the HTML code:
<button type="submit" class="parcel-btn weight-option" value="25" (click)="onItemSelector()">
<button type="submit" class="parcel-btn weight-option" value="50" (click)="onItemSelector()">
<button type="submit" class="parcel-btn weight-option" value="250" (click)="onItemSelector()">
<button type="submit" class="parcel-btn weight-option" value="100" (click)="onItemSelector()">
And here is the Typescript code:
onItemSelector() {
const weightSelector = this.elm.nativeElement.querySelectorAll('.weight-option').value;
console.log(weightSelector);
}