I have a select element which I need to retrieve the value of selected option and then set an array's index to that value. I need this to happen on page load and whenever select is updated.
It looks something like:
{{ Form::select('marketplace_id', $donation_options, '', array('data-smart-select', 'required', 'id' => 'marketplace_id')) }}
<span id="market_hint" class="help-block">{{ $marketplaces[0]['example'] }}</span>
The select ID is marketplace_id
The array is $marketplaces and it's a multi-dimension array with the second value always being ['example'] but the first value being the value of the select which is always a number such as 0,1,2,3,etc.
By current javascript can retrieve the value of the select:
$( "#marketplace_id" ).val();
But I am not sure how to proceed to update the array inside the market_hint span tag. Is there a simple method with jQuery?