I have a dropdown list containing all ontacts on a mobile phone. I want to select several contacts at the same time.
When I was working on regular html and JS pages, I used this code:
function loopSelected() { var txtSelectedValuesObj = document.getElementById('txtContactsName'); var selectedArray = new Array(); var selObj = document.getElementById('AllContacts'); var i; var count = 0; for (i=0; i<selObj.options.length; i++) { if (selObj.options[i].selected) { selectedArray[count] = selObj.options[i].value; count++; } } txtSelectedValuesObj.value = selectedArray; }
But when I use it on Android, then if statement
skipped and it just stops, this statement is:
"selObj.options[i].selected"
seems strange for mobile!
source share