I need help in using select multiple in Jquery using. Here is my code in snippset
$(document).ready(function() {
$('.select2').select2();
});
function edit(){
var MC_Value = $("#MC_value").val();
$("#the_value").val(MC_Value);//I dont know to show the value I am newbie
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://code.jquery.com/jquery-3.2.1.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js"></script>
<input type="text" class="form-control" id="MC_value" value='"Adam","George","John"'>
<a href="javascript:void();" onclick="edit()" class="btn btn-primary form-control"><span class="glyphicon glyphicon-pencil">Edit</span>
</a>
<br>
<select type="text" class="form-control select2" id="the_value" name="the_value" multiple>
<option value="Adam">Adam</option>
<option value="George">George</option>
<option value="John">John</option>
</select>
I am upload the image to show how i want this code run. but i am new in php and jquery. need help. Thanks master