javascript - How to bind event in knockout.js in dynamically added content? -
I want to add some content to my page after data binding, example:
Li & gt; & lt; div & gt; text & lt; / div & gt; & lt; div data-bind = 'event: {click: select dialog}' & gt; & lt; / Div> & lt; / li & gt; ".appendTo ($ (" #userClientGroup "). Search (" #earch-customer-ul-UCG "));
However, in this case the click event is not working; Can someone give me the solution?
You ko.applybindings (viewModel, $ ('#yourNewElement'))
Just be careful that you do not try to force an element, or you will receive an error.
Comments
Post a Comment