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 abstract class php?
How to get no of arguments passed to a PHP Function?
What is difference between php and html?
Do you know what's the difference between __sleep and __wakeup?
What is the difference between file_get_contents() and file_put_contents() in php?
What are the difference between overloading and overriding in oops?
What are the advantages and disadvantages of cascade style sheets?
What is list in PHP?
How does php work with apache?
Tell me will a comparison of an integer 12 and a string "13" work in php?
What is difference between get and post in php?
How to merge values of two arrays into a single array?
What is the difference between indexed and associative array?
What does $globals mean?
What are the method available in form submitting?