alim Posted October 29, 2007 Report Share Posted October 29, 2007 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 More sharing options...
justsomeguy Posted October 29, 2007 Report Share Posted October 29, 2007 You'll need to check the documentation for tinyMCE. Link to comment Share on other sites More sharing options...
alim Posted October 30, 2007 Author Report Share Posted October 30, 2007 I found sothing that do the effect i want to but i don't know if it deletes the element :tinyMCE.execCommand("RemoveFormat");New:it dosn't delete the element !!!Also i still have the same question How can i remove it ??? Link to comment Share on other sites More sharing options...
justsomeguy Posted October 30, 2007 Report Share Posted October 30, 2007 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 More sharing options...
alim Posted October 31, 2007 Author Report Share Posted October 31, 2007 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 More sharing options...
justsomeguy Posted October 31, 2007 Report Share Posted October 31, 2007 tinyMCE.execCommand('mceInsertRawHTML', false, "<span id=\"test\" style='background-color:silver;'>_____</span>");There's an ID right there. Link to comment Share on other sites More sharing options...
alim Posted November 5, 2007 Author Report Share Posted November 5, 2007 that's right, but Tiny filters out this id. I've checked that by taking a look at the html content of the added element. Link to comment Share on other sites More sharing options...
justsomeguy Posted November 5, 2007 Report Share Posted November 5, 2007 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now