Checkbox是随机生成span标签。 当前代码:

<asp:CheckBox ID="CheckBox_select"  type="checkbox" ClienIDMode="Static" runat="server" onclick="javascript:CheckCheckBox(this);" /> 
 
 
<asp:Label AssociatedControlID="CheckBox_select" ClientIDMode="Static" runat="server" ID="cbs" /> 

生成:

<span type="checkbox"><input id="CheckBox_select" type="checkbox" name="ctl00$ContentPlaceHolder1$GridView_reminderList$ctl02$CheckBox_select" onclick="javascript:CheckCheckBox(this);"></span> 

如何删除Span标签?

请您参考如下方法:

$('#CheckBox_select').unwrap();
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
<span type="checkbox"><input id="CheckBox_select" type="checkbox" name="ctl00$ContentPlaceHolder1$GridView_reminderList$ctl02$CheckBox_select" onclick="javascript:CheckCheckBox(this);"></span>

使用.unwrap()

Description: Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place.


评论关闭
IT虾米网

微信公众号号:IT虾米 (左侧二维码扫一扫)欢迎添加!