0

I am trying to set a value for DDL say

$('#ddlState').val("State");  //State matched the name in DD list value

i have this line in ready function and it works for text boxes but not DDL.

I am also using labelify plugin for text boxes but when i set values like

$('#txtBox').val("Some Value"); //Which is not same as title value

the some value is showing in the grey color.

Any clue?

Mat
  • 202,337
  • 40
  • 393
  • 406
user695663
  • 11,856
  • 8
  • 26
  • 32

2 Answers2

0

Check out this answer:

Adding options to a <select> using jQuery?

Community
  • 1
  • 1
Ira Rainey
  • 5,173
  • 2
  • 34
  • 42
0

Well for starters, .NET doesn't render the controls as

$('ddlState');

Try doing this:

$('#<% ddlState.ClientID %>').val('State');
Jack Marchetti
  • 15,536
  • 14
  • 81
  • 117