I'd like to display certain record from table according combo/drop
selection in Laravel. I'm following instructions from this thread but still can not get it to work.
Here is my view code and my jQuery script:
a. combo box
<select type="text" class="form-control" name="cde_mesg" id="cmb_mesg" required>
<option value="0" disabled="true" selected="true">
-- PICK MESSAGE--
</option>
@foreach($message as $messages)
<option value="{{ $messages->cde_mesg }}">
{{ $messages->nme_customer }}
</option>
@endforeach
</select>
b. text field
<input type="text" name="ad1_contract" id="ad1_contract" class="form-control">
c. jquery script
<script type="text/javascript">
$(document).ready(function(){
$("#cmb_mesg").change(function(){
var x = $(this).val();
$("#ad1_contract").val(x);
});
});
</script>