简体   繁体   English

从html删除完整的href链接标记

[英]remove complete href link tag from html

How to get 如何获得

EXPECTED INPUT : 预期输入:

<a href="#" id="r1A" role="button" tabindex="-1">
        <input type="button" id="r1B" value="Back" role="option" aria-pressed="false" class="keyboard-enabled" tabindex="6">
</a>
    <input type="submit" id="continue" value="CRA" name="continue" class="keyboard-enabled" tabindex="7">

converted to 转换成

<input type="button" id="r1B" value="Back" role="option" aria-pressed="false" class="keyboard-enabled" tabindex="6">

using JQUERY replace or remove. 使用JQUERY替换或删除。 Please suggest. 请提出建议。

您可以使用$ .fn.unwrap

$('#r1B').unwrap();

How about; 怎么样;

$('#r1B').parent().replaceWith($('#r1B'));

DEMO DEMO

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM