how to set value to select2?, I read in this SO, there are many ways, but nothing works for me, anybody can help?
<div class="form-group">
<label class="col-form-label" for="input-user_type">User type</label>
<select class="form-control select2-single" id="user_type" name="user_type">
<option></option>
<option>Internal</option>
<option>External</option>
<option>Admin</option>
</select>
<script type="text/javacsript">
$("#user_type").val("2"); **--> have tried this and no luck**
$("#user_type").select2().trigger('change'); **--> have tried this and no luck**
$('#user_type').val("2").select2();**--> have tried this and no luck**
$("#user_type").select2().select2('val','2'); **--> have tried this and no luck**
</script>
</div>