In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
Most people do not understand the knowledge points of this article "how to use the replaceall method in jquery", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to use the replaceall method in jquery" article.
In jquery, the replaceall method is used to replace the selected element with the new HTML element with the syntax "selected element .replaceAll"; this method has the same effect as the replaceWith () method, but the replaceall () method cannot be replaced with a function.
The operating environment of this tutorial: windows10 system, jquery3.2.1 version, Dell G3 computer.
What does the fire function in jquery mean?
The replaceAll () method replaces the selected element with the specified HTML content or element.
Hint: replaceAll () has the same effect as replaceWith (). The difference lies in the syntax: the content and the location of the selector, and that replaceWith () can be replaced with a function.
Grammar
$(content) .replaceAll (selector)
Content is required. Specifies to replace the contents of the selected element.
Possible values:
HTML code-such as ("")
New elements-such as (document.createElement ("div"))
Elements that already exist-such as ($(".div1"))
Existing elements are not moved, but are copied and wrapped around the selected element.
Selector is required. Specifies the element to be replaced.
Examples are as follows:
$(document) .ready (function () {$(".btn1") .click (function () {$(document.createElement ("div")) .replaceAll ("p");}); div {height:20px;background-color:yellow;margin:10px;}
This is a paragraph.
This is another paragraph.
Replace all paragraphs with the new div
Output result:
The above is about the content of this article on "how to use the replaceall method in jquery". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow 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.