Dies ist mein Skriptcode. Da stimmt etwas nicht.Versteckter Eingabefeldwert sollte entsprechend der Auswahlbox geändert werden
$(function() {
$('#type').on('change', function() {
if ($('#type').val('Workshop'))
$('#color').val('Orange'));
else if ($('#type').val('Social'))
$('#color').val('Green');
else if ($('#type').val('Other'))
$('#color').val('Red'));
});
});
Unten ist die Form von Drop-Box und verstecktes Feld.
{!! Form::select('type', array('type' => 'type','Workshop' => 'Workshop', 'Social' =>
'Social','Other' => 'Other'), 'type', ['id' => 'type']) !!}
{!! Form::hidden('color','', ['id' => 'color']) !!}
weitere Informationen zu OP hinzufügen besser als auch die HTML hinzuzufügen. – guradio
Was ist mit meinem Skriptcode? –
ich sehe nichts ungewöhnliches. wie fügst du das select hinzu? fügst du dynamisch hinzu? was passiert mit diesem code? addiere mehr info – guradio