title: How to set input name attribute equal to a variable using Handlebars?
body: <p>I am new to Handlebars.js and I'm trying to figure out how to a name attribute on radio buttons based on a variable defined in my JS. </p>
  
  <p>The below code currently gives the output I want except I would like to set the name attribute to different names according to the value of a variable. For example if the variable number were set to 4, I would like the name of all inputs to be 'answer4'.</p>
  
  <p>A little extra background info: The number variable is set as an argument in the quiz function, i.e. quiz("quizJSONFile", number); I use the number to define which html elements to append quiz questions and answers to.</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;script id="radio-template" type="x-handlebars-template"&gt;
      {{#each this}}
          &lt;input name='answer' type='radio' value='{{@index}}' &gt;{{this}}&lt;br&gt;
      {{/each}}
  &lt;/script&gt;
  </code></pre>
  
  <p>JS:</p>
  
  <pre><code>function createRadios(){
  var radioScript = $("#radio-template").html();
  var template = Handlebars.compile(radioScript);
   $("#question").append(template(allQuestions[counter].choices));
  };
  </code></pre>
  
  <p>JSON:</p>
  
  <pre><code>var allQuestions = [{
    question: "How many presidents were members of the Whig party?",
    choices: ["Four", "Three", "Two"],
    correct: 0
  }, {
    question: "Who was the first president to be impeached?",
    choices: ["Andrew Jackson", "Andrew Johnson", "Warren Harding"],
    correct: 1
  }, {
    question: "How many presidents died during their presidency?",
    choices: ["Four", "Six", "Eight"],
    correct: 2
  }, {
    question: "How many presidents had no party affiliation?",
    choices: ["One", "Two", "Three"],
    correct: 0
  }, {
    question: "Who was the only president to serve two non-consecutive terms, making him both the 22nd and 24th president?",
    choices: ["John Quincy Adams", "William Howard Taft", "Grover Cleveland"],
    correct: 2
  }];
  </code></pre>