Take the value of a radio button

Asked

Viewed 453 times

-1

Good evening, I’m finding it difficult to work with my form’s Radio Buttons at Angular. I need to take the values of my radio Buttons, but no solution found here works, neither with jquery nor with pure javascripty. Follows the code:

<mat-radio-group class="posicao" name="G>
  <mat-radio-button class="margem" name="G1" value="1">1</mat-radio-button>
  <mat-radio-button class="margem" name="G2" value="2">2</mat-radio-button>
  <mat-radio-button class="margem" name="G3 value="3">3</mat-radio-button>

1 answer

1

You have some open quotes. Also, use all radios with the same name.

<mat-radio-group class="posicao" name="G">
  <mat-radio-button class="margem" name="G" value="1">1</mat-radio-button>
  <mat-radio-button class="margem" name="G" value="2">2</mat-radio-button>
  <mat-radio-button class="margem" name="G" value="3">3</mat-radio-button>
  • I noticed the open quotation marks, I even edited to try to correct, but although I write correctly, for some reason I get like this, the same way n ta appearing the closing tag of mat-radio-group, but vlww by the correction :)

  • Tested using radios with the same name?

  • My problem is that I can’t access the property. value in my javascript, for some reason it returns an error, saying that the property . value does not exist.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.