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
  • 41,226
  • 116
  • 259
  • 398

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
  • 19,801
  • 7
  • 44
  • 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,568
  • 2
  • 16
  • 29
0

Change your selector to:

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

jsFiddle

SenorAmor
  • 3,321
  • 15
  • 27