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 the use of namespace in php?
Tell me how to initiate a session in php?
How to read one character from a file?
Why php is used with mysql?
Why do we use interface in php?
Why session timeout is important?
Php error constants and their descriptions
How to submit form without a submit button.
how to detect a mobile device using php
Why delimiter is used in mysql?
What is php good for?
When is a conditional statement ended with an endif?
What is difference between session and cookies in php?
Which function is used in php to check the data type of any variable?
What are the differences between session and cookie?