In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
Most people don't understand the knowledge points of this article "how to set click events to remove div elements", so Xiaobian summarizes the following contents for everyone. The contents are detailed, the steps are clear, and they have certain reference value. I hope everyone can gain something after reading this article. Let's take a look at this article "how to set click events to remove div elements".
Remove method: 1, with "$("button").click(function(){...}); "Statement, bind click events to button elements, and set event handling functions;2, in the processing function, use"$("div").remove();"statement to delete div elements and all internal contents.
This tutorial operates on Windows 7, jquery version 1.10.2, Dell G3 PC.
jquery Set click event Remove div element
Realization of ideas:
Binding click events to button elements with click() and setting event handling functions
In the processing function, remove the div element with remove()
remove() removes the selected element, including all text and child nodes.
The remove() method is used to remove elements "completely." The so-called "thorough" means that not only the element will be deleted, but also the event bound to the element will be deleted.
Implementation example:
$(document).ready(function() { $("button").click(function() { $("div").remove(); }); }); div{ color: red; } This is a div paragraph. A span element This is another div paragraph.
This is a p paragraph.
Click the button to remove div element
As you can see, a mouse click on the button (binding the element of the click event) removes the div element from the page.
The above is the content of this article about "jquery how to set click events to remove div elements". I believe everyone has a certain understanding. I hope the content shared by Xiaobian will be helpful to everyone. If you want to know more relevant knowledge content, please pay attention to the industry information channel.
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.