php - jQuery select box onchange event -


i have code this

$(function() {     $('#book_id').change(function(){         $('#book_code').show();         var get_value = $(this).val();         $( "#book_code" ).html( get_value );     }); });    <td>     <select id="book_id" name="book_name" class="form-control">     <option value="">select book</option>     <?php while($row=mysql_fetch_array($book_query)){?>         <option value="<?php  echo $row['book_code'];?>">         <?php  echo $row['book_name']; ?>         </option>         <?php  }?>     </select> </td> <td>     <div id="book_code">         <input type="text" class="form-control" value="" disabled="disabled" placeholder="book code" />     </div> </td> 

what want on each select event, need show book code inside input text box (not editable)

the above code works doesn't show value inside input box

how can that?

in other words, on each select event display book code inside text box

thanks, kimz

you may try (working example) :

$(function() {    $('#book_id').on('change', function(){        $('#book_code').find('input').val($(this).val());    }); }); 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -