Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8725657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:05:10+00:00 2026-06-13T08:05:10+00:00

With a Handlebars.js template like this… <select> <option value=Completed>Completed</option> <option value=OverDue>OverDue</option> <option value=SentToPayer>SentToPayer</option> <option

  • 0

With a Handlebars.js template like this…

<select>
    <option value="Completed">Completed</option>
    <option value="OverDue">OverDue</option>
    <option value="SentToPayer">SentToPayer</option>
    <option value="None">None</option>
</select>

… and data like this…

{
    "id"     : 1,
    "name"   : "World"
    "status" : "OverDue",
    "date"   : "2012-12-21"
}

I want to render HTML like this.

<select>
    <option value="Completed">Completed</option>
    <option value="OverDue" selected="selected">OverDue</option>
    <option value="SentToPayer">SentToPayer</option>
    <option value="None">None</option>
</select>

Which way is the easiest?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T08:05:13+00:00Added an answer on June 13, 2026 at 8:05 am

    I found a lot of over complicated solutions and decided to write my own using a Handlebars helper.

    With this partial (using Jquery) …

        window.Handlebars.registerHelper('select', function( value, options ){
            var $el = $('<select />').html( options.fn(this) );
            $el.find('[value="' + value + '"]').attr({'selected':'selected'});
            return $el.html();
        });
    

    You can wrap selects in your Handlebars template with {{#select status}}…

    <select>
        {{#select status}}
        <option value="Completed">Completed</option>
        <option value="OverDue">OverDue</option>
        <option value="SentToPayer">SentToPayer</option>
        <option value="None">None</option>
        {{/select}}
    </select>
    

    and end up with this…

    <select>
        <option value="Completed">Completed</option>
        <option value="OverDue" selected="selected">OverDue</option>
        <option value="SentToPayer">SentToPayer</option>
        <option value="None">None</option>
    </select>
    

    Presto!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a script handlebar.. <script id=ownerItem data-template-name='ownerItem' type=text/x-handlebars> {{value.UserName}} &nbsp;<button {{action remove on=click}}>Remove</button>
I have this view: <script type=text/x-handlebars data-template-name=articlesOne> <div class=main> <div id=articlesOne> <h2 id=article-title>{{App.ArticlesOneController.article.title}}</h2> <h3
How I can do to get the template Handlebars from file, like this: App.ApplicationView
I have a product block in a template like this : <script type=text/x-handlebars-template id=tmpl-person>
I would like to create a handlebars template and use a local helper for
I have a handlebars template in a public directory. I'd like to access the
Is it possible to run Javascript inside an Ember View Handlebars template? I want
I have the following in my page, ready to: <div id=result></div> <script id=some-template type=text/x-handlebars-template>
I'm having a small issue when I'm compiling a template with Handlebars.js . I
As documented here: http://www.jblotus.com/2011/05/24/keeping-your-handlebars-js-templates-organized/ I am trying to use this function: ( function getTemplateAjax(path,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.