just started looking into knockout.js library. I’m just curious to know if it is possible to have all the knockout data-bind expression handled by jQuery rather than inline in the html markup.
what i am trying to do is to have a clean markup and have all the javascript related stuff handled by the jQuery.
Not sure if it make sense to do it but just wanna see if it is possible
You could assign the
data-bindattributes through jQuery or other means, as long as you do it prior to callingko.applyBindingson those elements.Many unobtrusive techniques these days do involve using attributes like
data-something, so using thedata-bindattribute does follow that pattern. I suppose though at times the line is blurred when the content of thedata-bindcontains anonymous functions.