Javascript Question
- Started
- Last post
- 5 Responses
- -scarabin-
i'd like to wrap a tag (maybe a div or something) around a bunch of html that removes all tags but keeps tags
basically i want to strip everything out of the html inside except for tags.
any idea how to do this?
like with javascript or css or something?
- -scarabin-0
oops, NT stripped parts of my post. here it is in full:
----
i'd like to wrap a tag (maybe a div or something) around a bunch of html that removes all "a" (link) tags but keeps "img" tags
basically i want to strip everything out of the html inside except for "img" tags.
any idea how to do this?
like with javascript or css or something?
- -scarabin-0
a php solution would work as well
- heavyt0
you can wrap in a div ,
then try:
var v = document.getElementByID('v').inn...that will put all of the code inside of the div into a string.
then perform a bunch of
regex to remove the tags you want.with PHP, you can just use the strip_tags() method.
TR1
- -scarabin-0
it looks like striptags will work.
thanks!
- nicora20
something like this: call the parent tag
start = document.getElementById("start...
for (i=0; i < start.childNodes.length; i++)
{
start.childNodes[i].innerHTML = "";
}if you have nested elements, then you need to check the length of start.childNode[i].childNodes.le... then call the function recursivly