I have a select field and I'm trying to get the HTML within the selected HTML. It keeps returning as undefined.
I've read answers saying to user the .val() function but the value and the HTML aren't the same so it won't work.
HTML:
<select id="my_SiteUsers" style="width:250px;" onchange="RefreshGroupLists()">
<option value='default' disabled="disabled">Select a user</option>
</select>
JS:
var userText;
userText = $('#my_SiteUsers').html();
//check if default user selected alert(user);
if(user!="default"){
var removeConfirm = confirm("You are about to delete "+userText+"from SharePoint. Are you sure?");
if(removeConfirm){
$.SPServices({
operation:"RemoveUserFromSite",
userLoginName: user,
async:true
});
}
}
}