mercredi 30 mars 2016

Selected drop box value not changing the another field value in laravel 5

I want to set the hidden input field value to selected drop box value. Here is my hidden field code and drop box code.

 {!! Form::hidden('color') !!}


 {!! Form::select('type', array('type' => 'type','Orange' => 'Orange', 'Red' => 'Red','Green' => 'Green'), 'type') !!}

Below is my jquery.

<script>
$(document).ready(function(){
    $('#type').on('change',function(){
        $('#color').val($(this).val());

    });
    $('#Orange').on('change',function(){
        $('#color').val($(this).val());
    });
    $('#Red').on('change',function(){
        $('#color').val($(this).val());
    });
    $('#Green').on('change',function(){
        $('#color').val($(this).val());
    });
});

But as the hidden field value it will not set the value. Why is that?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire