User Tools

Site Tools


Sidebar

token:balanceddelete

.balancedDelete()

Method to delete a token, its corresponding ending tag if it exists and optional also the token's content. The script detects whether the token is a tag and whether the token has a corresponding end tag. If an end tag exists, the start tag and the end tag will be removed from the file. If the token is regular text or a tag without an end tag (such as img tags), only the token will be removed. This method is the equivalent of the function token_balancedDelete()

Usage

To delete only the token and retain its content

token.balancedDelete(false);

To delete the token and remove its content <code javascript> token.balancedDelete(true); <code>

Parameters

Parameter Data type Required Description
contentdelete boolean true If true, the function deletes not only the tag but also all the content of the tag. If false, the function only deletes the tag and the end tag (if it exists). Default is false

Return Values

Value String Value
true Token deleted
null Method encountered an error
token/balanceddelete.txt · Last modified: 2017/06/03 14:02 (external edit)