javascript - Reapply bindings after Fancybox with knockout -
I am trying to complete this result when a user clicks on a link then an inline fancy box contains html When the user entered a value and entered the hit, he should update the knockout and my view must be in order and the fancy box should face in a way.
This is my code so far, I know that I need to resend again,
HTML:
& lt; Div style = "display: none" & gt; & Lt; Div id = "inlineManufacturerAdder" & gt; & Lt; Div style = "width: 1000px;" & Gt; & Lt ;! - Days Deep Eli Content - & gt; & Lt; H2 & gt; Add new Creator 2 & lt; / H2 & gt; & Lt; P & gt; & Lt; Form data-bind = "submit: vm.addManufacturer" & gt; & Lt; Input type = "text" data-bind = "value: vm.new builder, value update: 'afterkeydown'" placeholder = "new creator" & gt; & Lt; / Form & gt; & Lt; / P & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt; Javascript (typewriter): Export function view attribute ($ {"(a.fancybox-link-add-manufacturer") Click (function (e) {$ .fancybox ({content: $ ('# inlineManufacturerAdder'). Html (), // This is where this is wrong, this content becomes and I think binding Forgets! Type: 'html'}); description is false;}); } If I use div (which is being set to display: none) in normal way so without the Fanbox everything works fine.
What should I do? I am using durandal!
You will not need to re-apply binding. Do not just pass in the internal HTML content, but pass it into the element node (or jquery example) in the fancy box.
instead of:
content: $ ('#inline manufacturer adider'). Html () Simply:
Content: $ ('#inlineManufacturerAdder') [Update]
Or some long lines:
& lt; A href = "#inlineManufacturerAdder" class = "fancybox-link-add-maker" & gt; Click me & lt; / A & gt; & Lt; Div id = "inlineManufacturerAdder" data-bound = "html: msg" & gt; & Lt; / Div & gt; & Lt; Script & gt; $ ("Fancybox-Link-Ed-Creator.") Fancybox () .; & Lt; / Script & gt; Here's an example:
Comments
Post a Comment