display selected value in dropdown list through javascript
without page refresh

Answer Posted / dhir

<html>
<body>

<script type="text/javascript">
var show
function showSelected()
{
show
=document.me.test.options[document.me.test.selectedIndex].value;

document.write(show);
}
</script>
<form name="me">
<select name='test' onChange='showSelected()'>
<option value='1'>one</option>
<option value='2'>two</option>
</select>
</form>
</body>
</html>

Is This Answer Correct ?    169 Yes 102 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Does cors prevent csrf?

531


Is php strongly typed?

617


How do I run a php script in windows?

558


Is php closing tag necessary?

559


A process can run only in the background. State Whether True or False?

628






What happens when submit button is clicked?

525


What is difference between include,require,include_once and require_once()?

532


What is use of count() function in php?

575


Does php support inheritance?

506


Which array function checks if the particular key exists in the array?

502


How to create an empty array in php?

587


What is binary safe function in php?

580


Explain how can php and javascript interact?

548


What are the methods of array in java?

495


What is php string function?

536