简体   繁体   中英

How to remove the tag with Jquery

how to remove <br> an item with Jquery the item going after class <class="item"> ? I use $(".item > br").remove(); but its not work

The css selector > denotes an immediate child. If you want a sibling (they have the same parent) immediately following the item, you can use the + selector. You can find other useful selectors in the W3C specification . Your could should therefore look like $(".item + br").remove(); assuming your html looks something like

<div class="item"></div>
<br />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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