JSFiddle - React, Tailwind, and code Playground

by benroe

HTML

<script src="https://dl.dropboxusercontent.com/u/12182625/ractive.js"></script>
<div id='template'></div>
<script id='temp' type='text/ractive'>
{{# opt[1]}}
    {{# { group: name, options: options } }}
    {{# options:i }}
        <label><input type='radio' name='{{~/selectedOpt[group]}}' value='{{this}}'> {{name}}</label>
            {{/}}
    {{/}}
{{/}}
<p>{{ JSON.stringify(selectedOpt)}}</p>
</script>

JavaScript

var ractive = new Ractive({
  el: 'template',
  template: '#temp',
  data: {
      selectedOpt: {group2:'foo21'},
      opt: [
          {name: 'group1', options: [
              'foo11',
              'foo12'
          ]},
          {name: 'group2', options: [
              'foo21',
              'foo22'
          ]},
      ]
  }
});