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
which will print out the php call stack?
How to open a file for writing?
Why framework is used in php?
What are default session time and path?
Is set in php?
What is difference between html and php?
Is empty check in php?
What does == mean in php?
How can cross site request forgery csrf be prevented?
What is a persistence cookie?
What is the purpose of constant() function?
Is php 5.6 secure?
Do you know what does $globals means?
How to set cookies?
What is implode() in php?