JQuery Radio buttonRadio buttons are used where mutually exclusive options are given to user to select.
Reading the default or selected radio button value on page load.When no event is occurred we can read the selected radio button value like this.
Here we are displaying selected radio button value inside one div layer.
Getting selected radio button valueWe can read the user selected radio button value by using this in Jquery
When event is not associated with radio buttons
Above code will return the value associated with the selected radio button. So to execute this code we will use one click event so any radio button is clicked by the user this part of the code will be triggered.
The returned value will be displayed inside one div tag ( id=t1)
Getting radio button nameSometime we are collecting records from database table and wants to give options to user to change one filed from True to False or vice versa
Based on the stored value of the record we will have one of the two radio button selected. Here once the user click one radio button, we need to know two variables. One is the record number and second is out of two which radio button is clicked ( True of False )
Here we will keep record number as name of the radio button ( for both radio buttons of each record ) and one radio button with value as True and other one value as False.
As mentioned in above code we can read the value , similarly here is the code to read the name of the radio button which is clicked.
Resetting radio buttonsOnce the selection is done by the user we can reset the same selection ( no selection ), here is the code.
Enable or disable all Radio buttonsBy click event of a button we can enable or disable the group of radio buttons.
Enable or disable single Radio buttons
Disabling two radio buttons
Using above concepts we can enable or disable based on the selection of the user. Let us say user has to select one of the two options, programming or graphics design. Based on the selection or choice of the user we will enable or disable two matching options out of four given options.
If programming is slected by user then options of graphics design will be disabled.