javascript - 如何删除复选框生成的span标签

标签 javascript jquery html asp.net

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.

关于javascript - 如何删除复选框生成的span标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37959573/

相关文章:

javascript - 在 JSON 中查找给定键的值并使用 javascript 更改该值

jQuery 中的绑定(bind)事件始终在最后执行

HTML/CSS : Show full size image on click

python - 使用 BeautifulSoup : Retrieving source code of a website 进行网页抓取

javascript - 循环遍历对象 React

javascript - 从 php 中按谷歌地图 api 中的城市名称自动填充州和国家/地区

javascript - jQuery 在单击不同的 li 时显示 li

html - 在 PowerPoint 中插入网页

javascript - 如何在博客文章标题后面插入图片

jquery - 有多少百分比的浏览器已加载 Google 的 JQuery 缓存版本?