User Tools

Site Tools


Sidebar

token:token_balanceddelete

token_balancedDelete()

Function 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 function is the equivalent of the method .balancedDelete()

Usage

To delete only the token and retain its content

token_balancedDelete(token, false);

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

Parameters

Parameter Data type Required Description
token Token object true The token to delete
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/token_balanceddelete.txt · Last modified: 2017/06/03 14:03 (external edit)