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
What is inheritance in php with example?
What is the use of 'print' in php?
sort term descripttion form, report and uery
What function do we use to find length of string, and length of array?
What is php sequence?
What type of headers have to be added in the mail function to attach a file?
What are sql functions?
Is it more secure to use cookies to transfer session ids?
What are variables in research examples?
How do you debug php?
When is a conditional statement ended with an endif?
How does php work with apache?
Can php use gettext?
What is the difference between php traits vs interfaces?
What happens when submit button is clicked?