0๐
โ
You could give the element an id
property, and then find the text of the selected option using javascript in a computed variable:
blade:
{!! Form::select('gender', ['M'=> trans('core.male') ,
'F'=> trans('core.female') ,
'X'=> trans('core.mixt') , ],
null, ['class' => 'form-control',"v-model"=>"gender","id"=>"gender"]) !!}
js:
....
computed:{
selectedText: function () {
this.gender = this.gender //this forces a re-compute when this.gender changes
var sel = document.getElementById('#gender');
if (sel.selectedIndex == -1)
return null;
return sel.options[sel.selectedIndex].text;
}
}
....
๐คJeff
Source:stackexchange.com