KnockoutJS Declarative HTML Binding - KnockoutJS

What is KnockoutJS - HTML Binding?

The HTML binding causes the associated DOM element which display the HTML specified by our parameter. This is really very useful if we want to a generate HTML markup dynamically.

Syntax

Parameters

KnockoutJS sets DOM element's content to parameter value provided. This functionality is also available in JQuery. If JQuery is not available then KO is used to achieve this.

If the parameter is an observable then elements value is updated as and when underlying observable is changed. Element is processed only once if no observable is used.

Example

Let us see below example which explains the use of html binding

Output

Let's carry out the below steps to see how the above code works:

First , Save the above code in html-bind.htm file.

Further,Open this HTML file in a browser.

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

KnockoutJS Topics