Содержание:
.replaceAll( target )Возвращает: jQuery
Описание: С помощью этой функции можно заменять элементы страницы новыми элементами или уже существующими.
-
Добавлен в версии: 1.2.replaceAll( target )
-
targetA selector string, jQuery object, DOM element, or array of elements indicating which element(s) to replace.
-
The .replaceAll()
method is similar to .replaceWith()
, but with the source and target reversed. Consider this DOM structure:
1
2
3
4
5
|
|
We can create an element, then replace other elements with it:
1
|
|
This causes all of them to be replaced:
1
2
3
4
5
|
|
Or, we could select an element to use as the replacement:
1
|
|
This results in the DOM structure:
1
2
3
4
|
|
From this example, we can see that the selected element replaces the target by being moved from its old location, not by being cloned.
Дополнительные замечания:
-
The
.replaceAll()
method removes all data and event handlers associated with the removed nodes.