View Single Post
Old 12-02-2012, 11:16 AM   PM User | #1
ebookz
New Coder

 
Join Date: Nov 2012
Posts: 33
Thanks: 23
Thanked 0 Times in 0 Posts
ebookz is an unknown quantity at this point
Question jQuery : how to parse selected value to another text box

here is my iQuery code :
Code:
<html>
<head>
<title>Selects jQuery parsed..</title>
<script type="text/javascript" src="jquery-1.8.3.min.js"></script>
<script type="text/javascript">
$(document).ready(function(e) {

$("#no_exam").change(function(){
var textval = $(":selected",this).val();
$('input[name=std_marks]').val(textval);
result_form.std_marks.disabled=(!textval)?false:true; // if select a value , text feild is readonly

})

});</script>
</head>

<body>
Selection :<select name="no_exam" id="no_exam">
<option value="" selected="selected">===select option===</option>
<option value="A+">100-75</option>
<option value="B+">50-74</option>
<option value="C+">0-49</option>
<option value="AB">AB</option>
<option value="NE">NE</option>
<option value="MC">MC</option>
</select></br>
Selected value :<input type="text" name="std_marks" id="std_marks"/>
</body>
</html>
this code is works perfectly for me...But I want to change this code ..

my problem is here this selection group have two categories...one is marks & other is absent..

* Marks category:100-75,50-74,0-49

* Absent category :AB,NE,MC

Here when I select a option then it's value is parse to the Selected value box..How can I edit this code to parse values only select Absent category options....(When I select a Marks category option ,do not parse a its value )
ebookz is offline   Reply With Quote