<span id="dd">Get</span>
<ul id='la' style="display:none;">
<li>
<a></a>
</li>
</ul>
<script>
var data = {
animals:[
{name: 'cat'},
{name: 'bird'},
{name: 'dog'}
]
};
var directive = {
'li':{
'animal<-animals':{ //for each entry in animales name the element 'animal'
'a': '
animal.name', //the dot selector, means the current node (here a LI)
'a@href':'animal.url',
'@data-url':'animal.url'
}
}
};
$("#dd").click(function(){
$( '#la' ).show()
//$('#la').find("li").remove();
$( '#la' ).render( data, directive );
});
</script>
if i press twice on get it will render more items,
i want to clear the template before i put the new data (assuming that the data is changing)