Reputation: 251
Here are the lines in my function that should be selecting the div
var t=1;
var problemId=1234;
var x="#problemTypeDtl&" +t+"_"+problemId;
$(x).Text('bites');
Here is the div:
<tr>
<td colspan="2">
<div class="problemStatusType" id="problemTypeDtl&1_1234"></div>
</td>
</tr>
It looks like the the selector is not selecting the div...what am I doing wrong?
Thanks in advance.
Upvotes: 1
Views: 229
Reputation: 7801
Why don't you make an all encompassing class called problemTypeDt
along with problemStatusType
(because I don't know if you need to keep that for something else) and use the problem ID as well...an ID. So
Script
var t=1;
var problemId=1234;
var x=t+"_"+problemId;
$("div.problemTypeDt#"+x).Text('bites');
Markup
<tr>
<td colspan="2">
<div class="problemStatusType problemTypeDt" id="problemTypeDtl&1_1234"></div>
</td>
</tr>
As noted above in the comments, it is illegal to use an ampersand.
Upvotes: 1
Reputation: 4515
Try escaping the ampersand:
var x="#problemTypeDtl\\&" +t+"_"+problemId;
Upvotes: 2