I'm trying to get the selected value from a Form::select in a blade's javascript file.
This is my blade:
{!!Form::open(['route' => [$complete == true ? 'completeAnalytical.store' : 'analytical.store'], 'method' => 'POST', 'id' => 'multiparametricAnalyticalForm'])!!}
{!! Form::select('fluid_type',['1' => 'Oil', '2' => 'Gas'], null, ['class'=>'form-control', 'id' => 'fluid_type']) !!}
{!! Form::submit('Run' , array('class' => 'btn btn-primary', 'id' => 'save')) !!}
This is the JS of my blade:
function myFunction() {
var myVar = $("input[name = fluid_type]").val();
console.log(myVar);
}
This is the console answer:
undefined
Is there any way to get the selected value ? Thanks so much for the help!