5

Given the below template and function, how can I pass the function argument contentText to display in the template #password-validation at the placeholder ###?

Template

<script id="password-validation" type="text/x-kendo-template">
    <p style="font-size: 12px; padding: 10px">
        ###
    </p>
    <div style="text-align: right">
        <button class="password-ok k-button">OK</button>
    </div>
</script>

Function

function PasswordValidation(contentText) {

var kendoWindow = $("<div />").kendoWindow({
    actions: ["Close"],
    title: "Password validation",
    resizable: false,
    modal: true
});

kendoWindow.data("kendoWindow")
    .content($("#password-validation").html())
    .center().open();

kendoWindow
    .find(".password-ok")
        .click(function () {
            kendoWindow.data("kendoWindow").close();
        })
        .end()
}
user1405195
  • 1,667
  • 4
  • 22
  • 35

1 Answers1

6

here is solution:

<script id="password-validation" type="text/x-kendo-template">
    <p style="font-size: 12px; padding: 10px">
        #=data#
    </p>
    <div style="text-align: right">
        <button class="password-ok k-button">OK</button>
    </div>
</script>

and function:

function PasswordValidation(contentText) {
    var kendoWindow = $("<div />").kendoWindow({
        actions: ["Close"],
        title: "Password validation",
        resizable: false,
        modal: true
    });

    var template = kendo.template($("#password-validation").html());
    kendoWindow.data("kendoWindow")
        .content(template(contentText))
        .center().open();

    kendoWindow
        .find(".password-ok")
            .click(function () {
                kendoWindow.data("kendoWindow").close();
            })
            .end()
}
Gene R
  • 3,684
  • 2
  • 17
  • 27