function GetItemsFromTheList()
{
var query = new SP.CamlQuery();
var textCAML = "<View><Query><Where><Eq><FieldRef Name='Ansvarig' /><Value Type='Text'>" + user.get_title() + "</Value></Eq></Where></Query></View>";
query.set_viewXml(textCAML);
var items = TidRapportering.getItems(query);
clientContext.load(items);
clientContext.executeQueryAsync(onSuccess, onFail);
function onSuccess() {
var listString = "";
var enumerator = items.getEnumerator();
while (enumerator.moveNext()) {
var currentItem = enumerator.get_current();
listString +="<br/> " + "Projekt namn: " + currentItem.get_item('Title') +
"<br/> " + "Användaren:" + currentItem.get_item('Name') +
"<br/> " + "Antal timmar per projekt: " + currentItem.get_item('AntalProjekt') +
"<br/> " + "Vecko nummer : " + currentItem.get_item('Veckonr') +
"<br/> " + "Status: " + currentItem.get_item('Status') +
"<br/> " + '<select id="ddStatus"><option >Skapad</option><option >Behandlar</option><option >Avslagen</option><option >Biviljad</option></select>' +
'<button type="button" onclick="alert()">Ändra status</button>' +
"<br/> " + '<span id="lblStatus" class="label label-info"></span>' +
"<br/> ";
}
$('#divAnsokningar').html(listString);
}
}
function onFail(sender, args) {
alert('Error:' + args.get_message());
}
}
function alert() {
jQuery('#btnStatus').on("click", function() {
var selectedText = jQuery("#ddStatus option:selected").text();
jQuery('#lblStatus').html(selectedText);
})
}
Any one can help me with getting dynamic dropdown list selected text and set it in the dynamic label by clicking on the dynamic button. I want to update currentItem.get_item('Status') in the my list (Tidrapportering) to the one of the ddStatus selected text