JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.11.4/themes/redmond/jquery-ui.css">
<!-- Load jQuery core library -->
<!--
<script type='text/javascript' src='http://code.jquery.com/jquery-2.1.4.min.js'></script>
-->
<!-- Load jQueryUI library-->
<!--
<script type='text/javascript' src='http://code.jquery.com/ui/1.11.4/jquery-ui.js'></script>
-->
<!-- Load jQueryUI Theme library (make either one effective) -->
<!--
<link rel="stylesheet" type="text/css" href='http://code.jquery.com/ui/1.11.4/themes/ui-lightness/jquery-ui.css'>
<link rel="stylesheet" type="text/css" href='http://code.jquery.com/ui/1.11.4/themes/ui-darkness/jquery-ui.css'>
<link rel="stylesheet" type="text/css" href='http://code.jquery.com/ui/1.11.4/themes/blitzer/jquery-ui.css'>
<link rel="stylesheet" type="text/css" href='http://code.jquery.com/ui/1.11.4/themes/eggplant/jquery-ui.css'>
<link rel="stylesheet" type="text/css" href='http://code.jquery.com/ui/1.11.4/themes/flick/jquery-ui.css'>
<link rel="stylesheet" type="text/css" href='http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css'>
<link rel="stylesheet" type="text/css" href='http://code.jquery.com/ui/1.11.4/themes/sunny/jquery-ui.css'>
<link rel="stylesheet" type="text/css" href='http://code.jquery.com/ui/1.11.4/themes/redmond/jquery-ui.css'>
-->
<h3>Plain (without styling/decoration):</h3>
<fieldset id='fieldset-selectiongrp-01'>
<legend>Please <b>click</b> to <b>select</b> or <b>re-click</b> to <b>deselect</b> </legend>
<span id='jQueryUi-selectiongrp-01'>
<input type='radio' name='selectiongrp-01' value='Yes' id='selectiongrp-01-option-Y'/><label for='selectiongrp-01-option-Y'>Yes</label>
<input type='radio' name='selectiongrp-01' value='No' id='selectiongrp-01-option-N'/><label for='selectiongrp-01-option-N'>No</label>
<input type='radio' name='selectiongrp-01' value='Unknown' id='selectiongrp-01-option-U' /><label...
JavaScript
function selectiongrp_control( s_selectiongrpName, b_useJQueryUiThemeToDecorate )
{
var ADF_THIS_IS_LAST_SELECTED_ATTR='adf_this-is-last-selected-attr'
var ADF_THIS_IS_LAST_SELECTED_VALUE='adf_this-is-last-selected-val';
if ( !s_selectiongrpName ) return -1;
$( '#fieldset-' + s_selectiongrpName + '-result' ).hide();
if( b_useJQueryUiThemeToDecorate ) $( '#jQueryUi-' + s_selectiongrpName).buttonset();
$( 'input[name=' + s_selectiongrpName + ']' ).each( function()
{
$( this ).on( 'click', function()
{
if( $( this ).attr( ADF_THIS_IS_LAST_SELECTED_ATTR ) )
{
$( this ).removeAttr( 'checked' );
$( this ).removeAttr( ADF_THIS_IS_LAST_SELECTED_ATTR );
} else
{
$( this ).attr( ADF_THIS_IS_LAST_SELECTED_ATTR, ADF_THIS_IS_LAST_SELECTED_VALUE );
}
$( 'input[name=' + s_selectiongrpName + ']' ).not( this ).removeAttr( ADF_THIS_IS_LAST_SELECTED_ATTR );
if( b_useJQueryUiThemeToDecorate ) $( '#jQueryUi-' + s_selectiongrpName ).buttonset( 'refresh' );
if( $( 'input[name=' + s_selectiongrpName + ']:checked' ).length > 0 )
{
$( '#fieldset-' + s_selectiongrpName + '-resultarea' ).html( 'You have selected : [' + $( this ).val() + '].');
} else
{
$( '#fieldset-' + s_selectiongrpName + '-resultarea' ).html( 'Nothing is selected.' );
}
$( '#fieldset-' + s_selectiongrpName + '-result' ).show();
});
});
}
$( document ).ready( function() {
var ADF_USE_JQUERYUI_THEME_TO_DECORATE=true;
selectiongrp_control( 'selectiongrp-01', !ADF_USE_JQUERYUI_THEME_TO_DECORATE );
selectiongrp_control( 'selectiongrp-02', ADF_USE_JQUERYUI_THEME_TO_DECORATE );
});