1

I have a drop down. One of the selections is Please Enter.

How do I force it to go to Please Enter

The id of the selectlist is called makeSelection

     $('select.makeSelection').val("Please Enter").attr('selected', 'selected'); 
Nate Pet
  • 44,246
  • 124
  • 269
  • 414

3 Answers3

2
$("#makeselection option[value='Press Enter']").prop('selected', 'selected');

For jQuery 1.6 you can use

$("#makeselection option[value='Press Enter']").attr('selected', 'selected');

Demo

Edit : Similar post

You may even be interested in why Prop and Attr

Community
  • 1
  • 1
mprabhat
  • 20,107
  • 7
  • 46
  • 63
0

If makeSelection is the Id, there will be only one so

   $('#makeSelection').val("Please Enter").attr('selected', 'selected');   

is enough.

S P
  • 4,615
  • 2
  • 18
  • 31
0

Change your selector to:

$('#makeSelection').val("Please Enter").attr('selected', 'selected');

jsFiddle

SenorAmor
  • 3,351
  • 16
  • 27