在 asp.net 中单击提交按钮时,我使用了以下代码来显示正在处理的图像,但在我编写此代码后,标题标签已自动添加,导致在页面顶部显示图像,现在我想删除这个标签或解决这个问题,每次我删除它都会自动恢复。 代码
script type="text/javascript">
function check()
{
$("#checking").show();
}
</script>
OnClientClick="check();"
<div id="checking" style="display:none;position: fixed;top: 0;left: 0;width: 100%;height: 100%;background: #f4f4f4;z-index: 99;">
<div class="text" style="position: absolute;top: 45%;left: 0;height: 100%;width: 100%;font-size: 18px;text-align: center;">
<center>
<img src="load.gif" alt="Loading">
</center>
Checking Please Wait!
<Br>Meanwhile Please
<b style="color: red;">BE ONLINE
</b>
</div>
</div>
以下代码已自动添加
<caption>
<img alt="Loading" src="load.gif"></img>
</caption>
最佳答案
您可以使用 unwrap()
从 DOM 中删除匹配元素集的父元素,将匹配元素留在原处。
$('img').unwrap('caption');
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<center>
<caption>
<img alt="Loading" src="load.gif" />
</caption>
</center>
Checking Please Wait! <Br>Meanwhile Please <b style="color: red;">BE ONLINE</b>
关于javascript - 如何从图像中删除标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50813585/