Easy Tutorial
❮ Jquery Dom Set Html Insertafter ❯

jQuery jQuery.htmlPrefilter() Method

jQuery Miscellaneous Methods

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 = '<del>删除</del><h1>标题</h2>';
    $('body').append($.htmlPrefilter(htm));
});

Definition and Usage

The $.htmlPrefilter() function modifies and filters HTML strings through jQuery manipulation methods.

Note: 1. This method is rarely needed to be called directly; instead, it can be used as a point of entry to modify existing jQuery manipulation methods.


Syntax

Parameter Description
html String type Operates on this HTML string

More Examples

Ensure any HTML string conforms to XHTML standards


jQuery Miscellaneous Methods

❮ Jquery Dom Set Html Insertafter ❯