-2
 <div class="wrapper-dropdown" id="primary_destination">
                                            <span>Primary Destination</span>
                                            <ul class="dropdown"  >
                                                @foreach(DB::table('formcountries')->get() as $r)
                                              <li data-v-6e3bf6e8="{{ $r->code }}" data-title="{{ $r->name }}" value="{{ $r->name }}" class="optionselect" id="selectboxes" onclick="optionselect(this.value);"><span class="selectspan">{{ $r->name }}</span></li>
                                              @endforeach
                                            </ul>
                                          </div>
<script type="text/javascript">
    function optionselect(value) {
  var params = $('#selectboxes').val();
  $('#testfield2').val(params);
}
</script>

<input data-v-5170d561="" type="text" placeholder="Destination"

  • Do you want to display the selected value on click of the dropdown @Malik ? – Govind Dec 12 '22 at 15:30
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Dec 12 '22 at 20:33

1 Answers1

0
On click of dropdown, the value will display in the input textbox.

Following is the code sample

<select name="ddlNumbers" id="ddlNumbers" onchange="getSelectedValue(this.value)">
  <option value="one">One</option>
  <option value="Two">Two</option>
  <option value="Three">Three</option>
  <option value="Four">Four</option>
</select>
<input id="txtvalue" type="text" placeholder="Destination"/>
    
function getSelectedValue(evt){
console.log(evt);
$('#txtvalue').val(evt);
}

enter image description here

Govind
  • 186
  • 5