How create radio button with js?

Hi Jean-Pierre!

Is there a particular reason you want to create radio buttons with JavaScript?

It is far easier to use the HTML “form” tag:

<form name="form1" action="">
  <input type="radio" name="gender" value="male"> Male<br>
  <input type="radio" name="gender" value="female"> Female<br>
  <input type="radio" name="gender" value="other"> Other
</form>

In Hype this code could go inside a rectangle’s “innerHTML”. When a user clicks on a radio-button, it becomes selected, and all other radio-buttons with equal name become unselected.

Example project:RadioBtns.hype.zip (20.8 KB)

1 Like