In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you how jquery deleted the previous element, I hope you will learn something after reading this article. Let's discuss it together.
Jquery method to delete the previous element: 1, use the prev () method to get the previous element object of the specified element, syntax "$(selector). Prev ()"; 2, use the remove () method to delete the previous element object, syntax "previous element object .remove ()".
The operating environment of this tutorial: windows7 system, jquery1.10.2 version, Dell G3 computer.
Jquery deletes the previous element
In jquery, to delete the previous element, you first need to get the previous element, which requires the use of the prev () method.
The prev () method returns the previous sibling of the selected element. (sibling elements are elements that share the same parent element. )
When you get the previous element, you need to delete it using the remove () method.
Implementation code:
$(document) .ready (function () {$("# but1") .click (function () {$("# box"). Prev (). Remove ();}))
The first paragraph
The second paragraph
The third paragraph
Paragraph 4-# box element
The fifth paragraph
The sixth paragraph
Delete the previous element of # box element
After reading this article, I believe you have a certain understanding of "how to delete the previous element of jquery". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.