gpt4 book ai didi

html - 当

标签包含
时,如何使整个

标签不显示?

转载 作者:太空宇宙 更新时间:2023-11-04 07:33:52 25 4
gpt4 key购买 nike

我想制作 display:none整体<p>仅包含 <br> 时的标记标签例如:

<p> <br> </p>

任何人都可以发布您对上述问题的答案

最佳答案

Try with this

$(document).ready(function(){
$('p').each(function(){
if($(this).children('br').length > 0){
$(this).hide();
}
})
})

或者全局创建一个函数。并在您需要的任何地方调用它。

$(document).ready(function(){
functionName();
})
function functionName(){
$('p').each(function(){
if($(this).children('br').length > 0){
$(this).hide();
}
})
}

关于html - 当<p>标签包含<br>时,如何使整个<p>标签不显示?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49144681/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com