如何更改字段集的图例当我单击编辑保留类型时,图例应更改为编辑保留类型
我的代码如下
<fieldset class="fieldset">
<legend style="text-align: left; font-weight: bold; width: 100px; padding: 0px 0px 0px 6px;" class="legend">Add Leave Type</legend>
// At the above line Filedset leged is Add Leave Type
<table width="100%" border="2">
<tr>
<td align="center">
<asp:RadioButtonList ID="rblLeaveType" runat="server" AutoPostBack="true"
RepeatDirection="Horizontal"
onselectedindexchanged="rblLeaveType_SelectedIndexChanged">
<asp:ListItem Text="Add Leave Type" Value="1" Selected="True"></asp:ListItem>
<asp:ListItem Text="Edit Leave Type" Value="2"></asp:ListItem>
// when Edit Leave type is true the legend should change to Edit Leave type
</asp:RadioButtonList>
</td>
</tr>
</table><br />
</fieldset>
答案 0 :(得分:0)
试试这个,给传奇一个id: -
$(document).ready(
$("#RadioButtonID").click(function(){
function() {
$('#legendID').text('Edit Leave Type');
}
});
);
答案 1 :(得分:0)
对于您的特定代码,您可以使用:
$('#rblLeaveType').find('input[type="radio"]').click(function () {
if ($(this).val() == 2 && $(this).not(':checked')) {
$(this).parents('fieldset').find('legend').text('Edit Leave Type');
} else {
$(this).parents('fieldset').find('legend').text('Add Leave Type');
}
});