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
When you want to show some part of a text displayed on an html page in red font color? What different possibilities are there to do this? What are the advantages/disadvantages of these methods?
How can we define a variable accessible in functions of a php script?
What is the method to register a variable into a session?
What is the function mysql_pconnect() usefull for?
When do you use define() and when do you use const. What are the main differences between those two?
What is php dependency injection?
How can you declare a constant variable in php?
What are the methods to submit form in php?
What is difference between post and put in rest?
Explain about the data types in PHP?
Can php replace javascript?
What is composer install?
What are default session time and path?
How to randomly retrieve a value from an array?
Tell me how can we determine whether a variable is set?