-5

How will i set selected value=Booking.

$('#status').val("Booking");
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<select name="status" class="form-control">
   <option value="" id="status">New</option>
    <option value="">Follow</option>
    <option value="">DND</option>
   <option value="">Dead</option>
</select>
Calvin Nunes
  • 6,376
  • 4
  • 20
  • 48

3 Answers3

1

try to follow the below example. there is no booking option in your select add it like below code

$('#mySelect')
         .append($("<option></option>")
                    .attr("value",key)
                    .text("Booking"));
Usama Kiyani
  • 195
  • 10
0

Try this:

<select id="status" class="form-control">
   <option value="">New</option>
    <option value="">Follow</option>
    <option value="">DND</option>
   <option value="">Dead</option>
  <option value="Booking">Booking</option>
</select>

and the script should be:

$(document).ready(function() {
  $('#status').val("Booking");
});

Also I have changed the name attribut to id since you are referring it using the '#' :)

Silvio Biasiol
  • 856
  • 8
  • 14
0

There should be any value of option like below so when you want to select booking option. so according to me it should be like that please check Is that matching with your requirement.<option value="new">New</option>

chhavi
  • 1
  • 1