Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

129
Vistas
Kendo Editor Dynamic Link onClick Function Not Working

I have a custom toolbar which inserts a link in kendo editor. I am trying to put a onClick function in that link but when the dynamically inserted link is clicked it says function is not defined. I also tried it by putting a class on that link and have a click function to that class but it does not get hit.

Any help would be much appreciated.

$("toolbarSubmitBtn").("click", function () {
    var value = $("toolbarInput").val();

    var $html = '<a onClick="myFunction()"> Click to show alert </a>';
    //var $html = '<a class="functioncall"> Click to show alert </a>';
    var $empty = $("<div>").append($html)
    $("#editor").data("kendoEditor").paste($empty.html());
});

Class Call

$(document).on("click", ".functioncall", function () {
    alert("function called from class");
});

Function Call

function myFunction() {
    alert("function called by click");
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I believe the issue is that the Kendo Editor puts the body content within an IFRAME and your "myFunction" is not within that IFRAME. Try setting the onClick to

window.parent.myFunction();


$("#toolbarSubmitBtn").on("click", function () {
    var $html = '<a href="#" onClick="window.parent.myFunction();" contenteditable="false"> Click to show alert </a>';          
    $("#editor").data("kendoEditor").paste($html);
});

Optionally, set contenteditable="false" on your inserted link to prevent user editing the link text.

Here is a DEMO

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda