I have a select option as below.
@foreach($destinations as $destination)
{!! Form::select('destination', $counts, $destination->ordering, array('onchange'=>'fetch_select(this.value,$destination->id)') !!}
@endforeach
I am trying to pass a variable called $destination->id in onchange function as above which will trigger a function in java-script later on. However, I am not able to pass this variable like i have done above. Throws a lot of errors. It says
Uncaught SyntaxError: Unexpected token >
in the inspect console.
I tried with:
'onchange'=>'fetch_select(this.value,destination->id)'
'onchange'=>'fetch_select(this.value,"$destination->id")'
'onchange'=>'fetch_select(this.value,(destination->id))'
'onchange'=>'fetch_select(this.value,($destination->id))'
None of them works .. How can i get around this. With Regards
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire