Monday, July 23, 2012

get all value of drop down list





<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>
function getalloption(){
arr=$('#ddlname option')

for(i=0; i< arr.length; i++){
alert($(arr[i]).val());
alert($(arr[i]).text());

 }



}

</script>
<select name="ddlnane" id="ddlname" >
<option value="1"> One </option>
<option value="2"> Two </option>
<option value="3"> Three </option>
<option value="4"> Fore </option>
<option value="5"> Five </option>
</select>
<input type="button" onclick="getalloption();" value="getOption"  />

No comments:

Post a Comment

If you Satisfied , Please Leave a comment