How can I set the default value of an element by comparing the innerHTML to a variable?
This is the select box
<select name="added_by" class="form-item-added_by" required="" id="id_added_by">
<option value="" selected="">---------</option>
<option value="1">admin</option>
</select>
This is what I've tried, but nothing happens.
<script type = "text/javascript">
$(document).ready(function(){
{%for note in notes%}
added_by = "{{note.added_by}}"
$(".form-item-added_by").val(added_by).change();
{%endfor%}
});
</script>