Jump to content

Delete an element from TinyMCE


alim
 Share

Recommended Posts

hello,i have a little problem here and i ask those who can for help.I'm adding an element with help this command like this :tinyMCE.execCommand('mceInsertRawHTML', false, "<span id="test" style='background-color:silver;'>_____</span>"); it works so far, my question is HOW can i remove it ? Thanks

Link to comment
Share on other sites

I assume that tinyMCE contains a way to delete things that you've added. Having never used tinyMCE, and not having any psychic powers that I'm aware of, I don't know the name of it. A 10-second Google search should tell you how to delete an element using tinyMCE.If you're just writing HTML to the page and not creating a specialized tinyMCE element, you can remove it using the id.document.getElementById("test").parentNode.removeChild(document.getElementById("test"))That is not specific to tinyMCE though, in general that's how you remove a node.

Link to comment
Share on other sites

hello justsomeguy,thanks for your reply. I think you are right with the 10 Second. But the problem is that this element was added dynamicly and i had and still have another problem, when i add this element it dosn't accept any Id. But if you have never worked with Tiny you may not understand exactly where the Problem is. Anyway the command that you wrote is usefull and i may need it ;- )best regardsAlim

Link to comment
Share on other sites

Then there's probably not a lot you can do, you'll need to check the tinyMCE documentation. If you create an object like that with an ID (here the ID is "test"), and then do this:alert(document.getElementById("test"));You should see something like "Object" if it exists, or "null" or "undefined" if it doesn't exist.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...