Hi Irfannturk,
Thank you for contacting Syncfusion forums.
To set dynamic generated element as context menu target, you can specify a common class for the dynamic elements with context menu and set that class in contextMenuTarget property. Once the dynamic element is added to the DOM, you need to wire the context menu events to the element to display the context menu on that target element. Kindly refer to the following code.
|
<button id="cxt" onclick="btnclick()" >Add dynamic target</button>
<script>
function btnclick(){
var menuObj = $("#contextMenu").data("ejMenu");
$("#sample").append("<div class='textarea context'> This is Dynamic content </div>");
menuObj._contextMenuEvents("_on");
}
</script> |
Regards,
Prince