Code:
<!DOCTYPE html>
<html>
<head>
<script src="jquery-1.8.3.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(e) {
$("#myOption").change(function(){
var textval = $(":selected",this).val();
$('input[name=student_mark]').val(textval);
myTestForm.student_mark.disabled=true; // if selecta value , text feild readonly
})
});</script>
</head>
<body>
<form name="myTestForm">
Selection :<select name="myOption" id="myOption">
<option value="">===select option===</option>
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>
</select></br>
Selected value :<input type="text" name="student_mark" id="student_mark"/>
</form>
</body>
</html>
This code has no errors..this works fine..when I select a option
then its value automatically set to the text box & text box become read only...that's ok..It's my target..But I have little bit problem when I select a option (One,Two or Three).. If I again select the default value "===select option===" then automatically read only text field is not come normally(means read & write mode)...I want if I select "===select option===" option then text field will be automatically become normal mode....Can any one fix this problem by editing this code...thanxx in advanced.....