[英]How To Hide Div Elements when Inspect Element?
i have a validator like this, 我有一个这样的验证器,
checkAmount: function(){
if(){
//true
$("#a").removeClass("d-none");
}
else{
//false
$("#a").addClass("d-none");
}
}
but when I inspect the div element it still appears like this 但是当我检查div元素时,它仍然像这样
<div id="a" class="col-md-7 offset-md-5 d-none"></div>
and I can easily remove the d-none class that was used for validation 而且我可以轻松删除用于验证的d-none类
The question is how do I hide the div when it is false so that I can't inspect the element? 问题是当它为false时如何隐藏div以使我无法检查该元素?
To remove html from your DOM 从DOM中删除html
$("#a").remove();
if you want to hide only then use 如果您只想隐藏,请使用
$("#a").hide();
$("DOM").hide(); $( “DOM”)隐藏()。 can be used to hide element 可以用来隐藏元素
$("DOM"). $( “DOM”)。 remove(); 去掉(); can be used to remove element which u can't see in browser inspect element 可用于删除您在浏览器中看不到的元素inspect元素
$("DOM").hide();
you can use this hide method to hide elements 您可以使用此hide方法隐藏元素
$("DOM").remove();
you can remove method to remove any hidden inspects elements 您可以删除方法以删除任何隐藏的检查元素
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.