JSFiddle - React, Tailwind, and code Playground

by Venkatesh Dematti

HTML

<div class="form-group gecko-field gecko-field-type-radio field-required" ng-class="{'field-required': field.required == 1, 'has-error': getError(field)}" ng-repeat="field in page.related_fields track by $index" id="field5730" ng-show="related_conditions &amp;&amp; checkConditional(field)">

                <!-- ngIf: showFieldLabel(field) --><label id="form_5730_label" class="field-label ng-binding ng-scope" for="form_5730" ng-if="showFieldLabel(field)">
                        Email Opt-in <!-- ngIf: field.required == 1 --><span aria-hidden="true" class="required ng-scope" ng-if="field.required == 1">*</span><!-- end ngIf: field.required == 1 -->
                </label><!-- end ngIf: showFieldLabel(field) -->

                <!-- ngIf: showFieldTitle(field) -->

                <p id="form_5730_description" ng-class="{'help-block': !isAdmin}" ng-show="showFieldDesc(field)" gecko-bind-html="field.help_text | linkify" class="ng-hide help-block"></p>
                <!-- ngIf: !isAdmin && field.type == 'section' -->
                <!-- ngIf: isAdmin && field.type == 'section' --><!-- /section -->

                <div ng-switch="field.type">
                    <!-- ngSwitchWhen: script -->

                    <!-- ngSwitchWhen: text --><!-- /text -->

                    <!-- ngSwitchWhen: number --><!-- /number -->

                    <!-- ngSwitchWhen: file --><!-- /file -->

                    <!-- ngSwitchWhen: hidden --><!-- /hidden -->

                    <!-- ngSwitchWhen: email --><!-- /email -->

                    <!-- ngSwitchWhen: event --><!-- /event -->

                    <!-- ngSwitchWhen: tel --><!-- /tel -->

                    <!-- ngSwitchWhen: url --><!-- /url -->

                    <!-- ngSwitchWhen: date --><!-- /date -->

                    <!-- ngSwitchWhen: organisation --><!-- /organisation -->

                    <!-- ngSwitchWhen: select --><!-- /select -->

                    <!-- ngSwitchWhen: multi --><!--...

JavaScript

var radioBtns = document.querySelectorAll("[type='radio']");
Array.prototype.forEach.call(radioBtns, function(radioBtn) {
    radioBtn.addEventListener("input", function(){
        alert(radioBtn.id);
    });
});