Hi all,
i have this custom Button function which works fine for me. Bu now i want to extend this function with one check. I want to check if the inserted Div already exists and stop processing.
Here is my code:
The div with the id = toc definitly exists, but my code always goes to the Else part of the if statement. Whats wrong?
thank you
yavuz
i have this custom Button function which works fine for me. Bu now i want to extend this function with one check. I want to check if the inserted Div already exists and stop processing.
Here is my code:
Telerik.Web.UI.Editor.CommandList["Inhaltsverzeichnis"] = function(commandName, editor, args) |
{ |
if (document.getElementById("toc")) { |
alert('Es existiert bereits ein Inhaltsverzeichnis-Tag im Content-Bereich!'); |
} |
else { |
editor.pasteHtml('Inhaltsverzeichnis<br /><br /><div id="toc">-Inhaltsverzeichnis-</div><br /><br />'); |
alert('Inhaltsverzeichnis wurde erfolgreich hinzugefuegt!'); |
} |
}; |
The div with the id = toc definitly exists, but my code always goes to the Else part of the if statement. Whats wrong?
thank you
yavuz