Reputation: 6615
<asp:TextBox ID="txtExp " runat="server" CssClass="dtext costlmw" Width="200px" onkeypress="return false" autocomplete="off" />
<asp:TextBox ID="txtExpID" runat="server" CssClass="dtext costlmw" Width="200px" onkeypress="return false" autocomplete="off" />
i have two text boxes, one has id txtExp and the other is txtExmpID
$("input[id*='txtExp']").val(sum.toFixed(2));
the line above updates BOTH textboxes with the value sum
i guess *
means "contains"? but i thought that's what ~
means?
$("input[~id='txtExp']").val(sum.toFixed(2));
i've also tried
$("input[id='txtExp']").val(sum.toFixed(2));
when then nothing happens at all.
Upvotes: 0
Views: 30
Reputation: 43706
*=
mean the value of the attribute contains the specified word. ~=
mean the value of the attribute is sliced into whitespace separated words, and the specified word matches one of those whitespace separated word exactly.
Also ~id="xxxx"
is a wrong syntax.
Upvotes: 0
Reputation: 104805
Use the ID selector #
$("#txtExp").val(x);
ASP.NET renders your ID's differently -- Either use the ClientID
property, set the ClientIDMode
, or just use a .
and target the class.
Upvotes: 4