Use at own risk. Programs haven't been thoroughly tested.
function: removeTagChildsByAttr
Removes all tags whose attribute corresponds with a value
Info
@author Kevin van Zonneveld
@version 0.1
@link http://kevin.vanzonneveld.net
@param (string) strobj The type of tag
@param (string) stratt The name of the attribute
@param (string) strval The value to match
@version 0.1
@link http://kevin.vanzonneveld.net
@param (string) strobj The type of tag
@param (string) stratt The name of the attribute
@param (string) strval The value to match
Example
Usage
Outputs
(removes all A tags whose class is 'menu')
removeTagChildsByAttr('A','class','menu')
Outputs
(removes all A tags whose class is 'menu')
Source Code
download sourcefunction removeTagChildsByAttr(strobj,stratt,strval){ var objs = document.getElementsByTagName(strobj); for(no=0;no<objs.length;no++){ if(objs[no].getAttribute(stratt)==strval){ objs[no].parentNode.removeChild(objs[no]); } } }
No comments. Be the first!