I want to check if id is equal to <li>contact id or not, my jquery code is below:
var points = new Array();
var i = 0;
$(this).toggleClass('selected');
$('#result').html($('#firstList .selected').clone());
$id = $(this).attr('id');
{% for contact in contacts %}
$idd = "{{ contact.id }}";
if ($id === $idd){
points[i] = "{{ contact.gsmPrimary}}";
i++;
$('#result').val(points.join(';'));
}
{% endfor %}
First I get ideach select element li, and then I have a contact object, I want to check if the id of the selected <li>contact is equal to .id or not, if it is equal I will add contact.gsmprimaryin textareawith the name result
thanks for the help
source
share