Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is "data-bind" a strictly knockout-only attribute?

I know that one can always define own custom attributes for an HTML tag.

I also know that data-bind is the keyword knockout.js chose as the HTML attribute that links the data to the UI.

So far so good.

What I am curious to know is whether when I come across HTML on some website and I see that it uses the attribute data-bind, does it always imply it uses knockout.js?

<span class="chk" data-bind="visible: selectedAnswers().length > 0" />

In other words, what is the likelihood that a website using the data-bind attribute is not using knockout.js?

like image 387
datps Avatar asked May 29 '26 20:05

datps


1 Answers

No it's not... I've used data-bind in projects not involving knockout. As long as it makes sense as to what the data is going to be used for then you can use whatever string you want (within reason, see below)...

data-bind=""

data-binder=""

data-im-a-data-attribute=""

The data-* attributes consist of two parts:

1) The attribute name should not contain any uppercase letters, and must be at least one character long after the prefix "data-"

2)The attribute value can be any string

Info obtained from here

like image 147
ann0nC0d3r Avatar answered Jun 01 '26 08:06

ann0nC0d3r