knockout.js Bindings - Text and appearance Attr

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

Use the attr binding to apply any additional attributes to your element. Most commonly used for setting an href, src, or any data-attributes.

<img data-bind="attr: { src: url, title: title }"/>
var viewModel = {
    url: ko.observable("images/example.png"),
    title: "example title"
};


Got any knockout.js Question?