user3988645
user3988645

Reputation: 135

Binding HTML Text in Kendo

I have the codes below:

<div id="container">
     ..........
     <p class="text"><span data-bind="text: textWRGENRE"></span> </p>
     ..........
</div>

<script>
    var viewModel = kendo.observable({
            textWRGENRE: null
        }),

    kendo.bind($("#container"), viewModel);

    function setData(){
        var text = "some value with HTML tag, example <p> this is a test. </p>"

        viewModel.set("textWRGENRE", text);
    }
<script>

The code above renders the value for "textWRGENRE" but it also renders the HTML tag. What I want to happen is to display only the text " this is a test. "

Is that possible?

Thanks

Upvotes: 1

Views: 1824

Answers (1)

Yograj Gupta
Yograj Gupta

Reputation: 9869

Use html instead of text, If you dont want encoded markup tags. html binding will bind html content, so html will render. Like:

<span data-bind="html: textWRGENRE">

Upvotes: 4

Related Questions