我想讀取JQuery中的項目值,根據我希望啓用或禁用基於標籤值的列表視圖中的錨定標記的值。任何幫助,將不勝感激。如何閱讀JQuery中的列表視圖項目(標籤)
$(document).ready(function() {
$('#Coverage-link').live('click', function(e) {
var IsRestriction = ***I want to read a label text(lblRestrictions) here***
if (IsRestriction == "More") {
$('#Coverage-form').dialog('open');
} else {
e.preventDefault();
}
return false;
});
});
ListView項 -
<ItemTemplate>
<tr >
<td align="left" style="width:180px">
<asp:Label ID="lblDrugName" runat="server" Text='<%# Eval("DrugDescription") %>' />
</td>
<td style="width:120px" align="center">
<asp:Label ID="lblStatus" runat="server" Text='<%# Eval("FormularyStatusDescription") %>' />
</td>
<td align="left" style="width:250px">
<asp:Label ID="lblFlat" runat="server" Text='<%# Eval("CopayInfo") %>' />
</td>
<td style="width:80px;padding-right:10px;" align="center">
<!--<asp:Label ID="lblCoverageRestrictions" runat="server" Text='<%# Eval("Restrictions") %>' /> -->
<a href="#" id="Coverage-link">
<asp:Label ID="lblRestrictions" runat="server" Text='<%# Eval("Restrictions") %>' ></asp:Label>
</a>
</td>
</tr>
</ItemTemplate>
下面是HTML輸出 -
<table id="eligibility-data">
<thead style="background-color:#90a595;">
<th style="width:180px">Drug Name</th>
<th style="width:120px;">Formulary Status</th>
<th align="left" style="width:250px">Copay Information</th>
<th style="width:80px;padding-right:10px">Restrictions</th>
</thead>
<tbody>
<tr >
<td align="left" style="width:180px">
<span id="ctl00_MainContentPlaceholder_formularyControl_lvCopayInformation_ctrl0_lblDrugName">ibuprofen 200 mg oral capsule</span>
</td>
<td style="width:120px" align="center">
<span id="ctl00_MainContentPlaceholder_formularyControl_lvCopayInformation_ctrl0_lblStatus">On - Preferred (2)</span>
</td>
<td align="left" style="width:250px">
<span id="ctl00_MainContentPlaceholder_formularyControl_lvCopayInformation_ctrl0_lblFlat">No Copay Info Available.</span>
</td>
<td id="tdRestrictions" style="width:80px;padding-right:10px;" align="center">
<!--<span id="ctl00_MainContentPlaceholder_formularyControl_lvCopayInformation_ctrl0_lblCoverageRestrictions">None</span> -->
<a href="#" id="Coverage-link">
<span id="ctl00_MainContentPlaceholder_formularyControl_lvCopayInformation_ctrl0_lblRestrictions">None</span>
</a>
</td>
</tr>
</tbody>
</table>
您可以共享最終的HTML輸出,而不是ASP服務器端代碼嗎? – Blazemonger
請找到添加的HTML代碼。 – Senthil