Search results

Custom Tooltip with dynamic HTML

Tooltip loads HTML pages via HTML tags such as iframe, video, and map using the content property, which supports both string and HTML tags.

To load an iframe element in tooltip, set the required iframe in the content of tooltip while initializing the tooltip control. Refer to the following code.

content: '<iframe src="https://www.syncfusion.com/products/essential-js2"></iframe>
tagHelper
html-page.cs
<div id="container">
        <ejs-tooltip id="target" cssClass="e-tooltip-css" opensOn="Click" width="350" height="250" content="<iframe src='https://www.syncfusion.com/products/essential-js2' id='tooltipFrame'></iframe>">
            <e-content-template>
                <div id="tooltipContent">
                    <div class="content">
                        <button class="text" id="iframeContent">Embedded Iframe</button>
                    </div>
                </div>
            </e-content-template>
        </ejs-tooltip>
    </div>

<style>
#tooltipContent {
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    margin: 65px 10px;
}

.content {
    display: inline-block;
    width: 49%;
}

#tooltipFrame {
    width: 332px;
    height: 233px;
}

.content button {
    position: relative;
    left: 50%;
    transform: translateX(-50%);
}
</style>
public ActionResult TooltipView()
{
    return View();
}