display selected value in dropdown list through javascript
without page refresh
Answer Posted / drorasta
you don't need to use AJAX for this. Just a simple
javascript:
<html>
<body>
<script type="text/javascript">
function showSelected(val){
document.getElementById
('selectedResult').innerHTML = "The selected number is - "
+ val;
}
</script>
<div id='selectedResult'></div>
<select name='test' onChange='showSelected(this.value)'>
<option value='1'>one</option>
<option value='2'>two</option>
</select>
</body>
</html>
| Is This Answer Correct ? | 375 Yes | 116 No |
Post New Answer View All Answers
Is it difficult to learn php?
What is difference between static and final in php?
Tell me what does the scope of variables means?
Is php still used?
How can you execute php script from the command line?
What is difference between array_merge and array_combine?
What are the features of php?
What is php call function?
Which cryptographic functions in php returns the longest hash value?
What is php.ini & .htacess file?
What is whitespace in php?
Explain what does the unset() function means?
Tell me what is the use of isset() in php?
Tell me how can we determine whether a php variable is an instantiated object of a certain class?
What are the encryption functions in php?