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


Please Help Members By Posting Answers For Below Questions

What is abstract class php?

514


How to get no of arguments passed to a PHP Function?

496


What is difference between php and html?

488


Do you know what's the difference between __sleep and __wakeup?

528


What is the difference between file_get_contents() and file_put_contents() in php?

675






What are the difference between overloading and overriding in oops?

537


What are the advantages and disadvantages of cascade style sheets?

664


What is list in PHP?

640


How does php work with apache?

519


Tell me will a comparison of an integer 12 and a string "13" work in php?

652


What is difference between get and post in php?

604


How to merge values of two arrays into a single array?

482


What is the difference between indexed and associative array?

500


What does $globals mean?

522


What are the method available in form submitting?

527