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

What is the timeout period on session values?

806


What is php sequence?

718


What does it mean when it says the csrf token is invalid?

687


How to join multiple strings into a single string?

729


What is the basic function to search files for lines (or other units of text) that contain a pattern.

786


What is php limit?

720


What is the method to execute a php script from the command line?

788


What is variable declaration?

679


What is the difference between pop3 IMAP and MAPI?

841


Does jwt protect against csrf?

679


How to set session.gc_maxlifetime properly?

787


What is difference between sql and php?

795


Can I use php in visual studio?

742


When do sessions end?

718


What is php and its features?

714