im trying to create an autosuggestion feature in jquery(just experimental- jquery noob), im using the $(el).html function to render out the data that is being served:
$("#suggestions").addClass("active");
var words = $(this).val();
var results = searchData(questions,words);
$("#suggestions").html(function () {
_.each(results, function(q, key){
return "<p>" + q.question + "</p>"; // problem is here
});
});
the full working code is here: http://jsfiddle.net/HSBWt/6/
i cant seem to know what going wrong?
http://jsfiddle.net/HSBWt/9/
Use the
mapfunction to get back an array of the objects