How to Get text value from dropdown using javascript?
How to get select text from option box in JavaScript ?
<!DOCTYPE html PUBLIC "-//ittutorialC//DTD XHTML 1.0 Transitional//EN" "http://www.ittutorial.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.ittutorial.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>How to get select box option text in JavaScript</title>
<script type="text/javascript">
function ShowOptionText() {
var selected_object = document.getElementById('typeofwork');
var selected_index = selected_object.selectedIndex;
alert(selected_object.options[selected_index].text);
}
</script>
</head>
How to get the value of checkboxes selected in JavaScript
<!DOCTYPE html PUBLIC "-//ittutorialC//DTD XHTML 1.0 Transitional//EN" "http://www.ittutorial.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.ittutorial.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>How to get the value of checkboxes in the order they are selected</title>
<script type="text/javascript">
arr = new Array();
function CheckboxOrder(elemId){
var chkBox = document.getElementById(elemId);
if(document.getElementById(elemId).checked) {
arr.push(elemId);
}
else {
for(var i = arr.length; i>=0; i--){
if(arr[i]==elemId){
arr.splice(i,1);
break;
}
}
}
for(var i = 0; i<=(arr.length-1); i++){
alert("checked value list ::"+arr[i]);
}
}
</script>
</head>