jQuery jQuery.htmlPrefilter() method
Example
Remove all ~~tags~~ from the incoming HTML string
$
(
function
(
)
{
var
htmlPrefilter
= $.
htmlPrefilter
,
rdel
= /<
(
del
)
(
?=
[
\
s
]
)
[
\
w
\
W
]
*?
1
\
s
*>/
gi
; $.
htmlPrefilter
=
function
(
html
)
{
return
htmlPrefilter
.
call
(
this
,
html
)
.
replace
(
rdel
,
"
"
)
;
}
;
var
htm
=
'
Delete
Title
'
; $
(
'
body
'
)
.
append
(
$.
htmlPrefilter
(
htm
)
)
;
}
)
;
Try it »
Definition and Usage
The $.htmlPrefilter() function modifies and filters HTML strings through jQuery manipulation methods.
**Note:** 1. This method rarely needs to be called directly; instead, it can be used as an entry point for modifying existing jQuery manipulation methods.
Syntax
$
.htmlPrefilter( html )
| Parameters | Description |
|---|---|
| html | String type: Operate on the HTML string |
More examples
Ensure that any HTML string conforms to the XHTML standard
Any HTML string conforms to the XHTML standard; removing all tags from the incoming HTML string solves this too.
jQuery Miscellaneous Methods