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

Why overriding is called runtime polymorphism?

741


What is input sanitization in php?

746


What is the difference between array_map () and array_shift ()?

743


What is the use of mysql_fetch_assoc in php?

753


What are the types of variables in php?

807


What beforeFilter() is used?

856


What are the different opening and closing tags available in PHP?

786


What is the purpose of $_ session?

712


How does session work in php?

758


What is difference between get and post?

767


What is the use of print_r function in php?

731


Write a program in php to print a table of a number?

710


What are the differences between GET and POST methods in form submitting?

835


How can you propagate a session id?

741


How is it possible to return a value from a function?

775