I have a search form that can display a list of persons matching the searching filters. Once the search results are displayed, I want a link (id=names_list) that, when clicked, displays a dialog box displaying the list of the persons names.
I don't understand why this code is not working :
<a id="names_list" href="#">Names list</a>
{% for person in persons %}
<a class="name_for_mylist">{{ person | name }}</a>
{% endfor %}
<script>
$(document).ready(function()
{
$("#names_list").click(function(event){
event.preventDefault();
var list = "";
$(".name_for_mylist").each(function(){
list += $(this).html() + "; ";
});
var box=list.dialog({ title: "Names list" });
box.show();
});
});
</script>
Thanks a lot for your help!
.dialog()function has to be applied to an HTML element in the DOM, not a string.