I have this code :
<script>
function getgroup(){
var i=0;
var total=document.getElementById("selectedOptions").length;
while (i<total)
{
var group=document.getElementById("selectedOptions").value;
var group2=group.substring(2);
alert(group2);
i++;
}
}
</Script>
I want to loop inside the list and get the value of each item in the list.
By using this code I am getting only the value of the first item only.
Any help please?
You are assigning the value of the select element to the group variable. You need to loop through the options instead: