jQuery jQuery.htmlPrefilter()Method
Example
Remove all from the passed-in HTML stringtags
$(function() {
var htmlPrefilter = $.htmlPrefilter,
rdel = /<(del)(?=[\s>])[\w\W]*?<\/\1\s*>/gi;
$.htmlPrefilter = function( html ) {
return htmlPrefilter.call( this, html ).replace( rdel, "" );
};
var htm = '<del>Delete</del><h1>Title</h2>';
$('body').append($.htmlPrefilter(htm));
});
Try it Yourself »
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; rather, you can use it as an entry point for modifying existing jQuery manipulation methods.
Syntax
$.htmlPrefilter( html )
| Parameters | Description |
|---|---|
| html | String type Perform operations on this HTML string |
More Examples
Ensure any HTML string conforms to XHTML standards
Any HTML string conforms to XHTML standards; removing all <del> tags from the passed-in HTML string can also be solved in this way.
Other Extensions
jQuery Miscellaneous Methods