Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要能够删除和替换以下代码中 </div> 之后的 4 个 <br> 标签。我可以控制的页面部分从标签开始,而不是上面的代码。提前致谢。
<pre> <div class="pageTitle"> <h1>Unit 2: Week X - Discussion Example</h1> </div> <br> <br> <br> <br> <style type="text/css"> ...
div
$("div.pagetitle").siblings("<br/>,<br>").remove()
h1
$("h1").parent().siblings("<br/>,<br>").remove()
参考 :
Why not use nextAll selector like this:
$('div.pageTitle').nextAll('br');
or you can use simple next selector:
$('div.pageTitle').next('br')
and then loop over this 4.