Reputation: 24052
Trying to set this textbox
<%= Html.TextBoxFor(m => m.IndicationCalculatorNewGroupName, new {propertyName = "IndicationCalculatorNewGroupName", onchange = "UpdateField(this);", dontRegisterNewIndication = true })%>
like this:
$("#IndicationCalculatorNewGroupName").val('-- Enter new Group Name --');
I am accessing it fine using that Id and everything when I do other things like $("#IndicationCalculatorNewGroupName").show();
but not when I try and set it's text.
Thanks!
Upvotes: 1
Views: 3011
Reputation: 10521
$('#IndicationCalculatorNewGroupName').val('-- Enter new Group Name --');
is the correct jQuery syntax, so the issue is something else.
Here is a jsfiddle showing this: http://jsfiddle.net/bdL2Q/
Can you provide additional details please?
What is the markup generated by Html.TextBoxFor
?
What is the exact jQuery code you are trying to run? (Is it as simple as the snippet you posted?)
Upvotes: 2