jeudi 29 janvier 2015

Handlebars select and pass jquery contains by condition

he its abit complicated qustion...


i am useing Handlebars.registerHelper in a app and i have a problem my hbs is divided to two


hbs:



{{#if isFirstPlace}}
<div id="main">
<h1><a>{{n}}</a><a>{{name}}</a></h1>
<a>{{img}}</a>
</div>
{{else}}
</div>
<a><a id="place">{{n}}.</a><a id="img">{{img}}</a><a id="name">
{{name}} </a></a>
{{/if}}


so i need help with the function... the page is rendring and display result in ul-il div and i need to search if inside #n is there text like "1" and get it parent so i get this code:



$("[id=place]:contains('1')").parent();


so i need the function to select the element and pass it to the top option on the Handlebars registerHelper {{#if isFirstPlace}}. so i wil get a difrent strecture for the specific element and evryting else need to stay in the bottom page the {{else}}.


i have try to append() the html and prependTo(#div) but i cant pass the {{name}} {{n}} {{img}} tag inside append. i have try evryting i am lost can anaybody help me? thanks!





Aucun commentaire:

Enregistrer un commentaire