New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial
Disable RadEditor and browser context menus for a specific HTML element
Environment
Product | RadEditor for ASP.NET AJAX |
Description
Learn how to hide the RadEditor context menu and not to show the default browser's context menu for a specific FORM element tag - SELECT
Solution
The solution is the following:
ASP.NET
<script type="text/javascript">
function CallContextMenu(editor) {
editor.attachEventHandler("oncontextmenu", function (e) {
var oSelection = editor.getSelection().getParentElement(); //get the selected element
if (oSelection.tagName.toLowerCase() == "select") {
$telerik.cancelRawEvent(e); //disable the browser's context menu
return false;
}
});
}
</script>
<telerik:RadEditor runat="server" ID="RadEditor1" OnClientLoad="CallContextMenu">
<Content>
<select disabled="true"> <option selected="true">Content A</option> </select>
</Content>
</telerik:RadEditor>