Skip to content
Advertisement

How to get only a corresponding entry box regardless of how many times I change radiobutton?

JavaScript

In this code I want that when I select radiobutton number, only enter a number should appear and same for the other. But the problem is that when I select number after selecting alphabet, it shows both. I need only the selected one and eliminate the other instantly.

Advertisement

Answer

This is how I would approach this issue:

JavaScript

As You can see if You don’t plan on using the widgets instance anywhere You don’t have to assign it to a variable. Also no need to configure label in both statements since that will be done anyways so just do it at the beginning, also rows start from 0 too. Frames help with organizing widgets. Also if You want neither of the radiobuttons selected set the variable to 0.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement