Note that there are some explanatory texts on larger screens.

plurals
  1. POChange facebook data-* dynamically with Knockout.js
    primarykey
    data
    text
    <p>I want to change facebook like button settings like <a href="http://wix.com" rel="nofollow">wix.com</a>'s HTML Editor. </p> <p>I created a viewModel: </p> <pre><code>&lt;script&gt; //Asynchronous JavaScript loading (function (d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/all.js#xfbml=1"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); var viewModel = { //Facebook Button LayoutStyles: ko.observableArray([ { Title: "Standart", Value: "standart" }, { Title: "Button", Value: "button_count" }, { Title: "Box", Value: "box_count" }]), ColorSchemes: ko.observableArray([ { Title: "Light", Value: "light" }, { Title: "Dark", Value: "dark" }]), selectedStyleValue: ko.observable(), selectedColorValue: ko.observable(), withFaces: ko.observable(false), withSend: ko.observable(true), width: ko.observable(450) }; ko.applyBindings(viewModel); &lt;/script&gt; </code></pre> <p>And I placed a fb button like this:</p> <pre><code>&lt;div id="fb-root"&gt; &lt;/div&gt; &lt;div class="fb-like" data-bind="attr:{ 'data-width':width,'data-send':withSend,'data-show-faces':withFaces}"&gt; &lt;h4&gt;Facebook Like Button Settings &lt;/h4&gt; &lt;div class="control-group"&gt; &lt;label class="control-label" style="white-space:nowrap;"&gt;Layout Style&lt;/label&gt; &lt;div class="controls"&gt; &lt;select class="" data-bind="options:LayoutStyles,optionsText:'Title',optionsValue:'Value',value:selectedStyleValue"&gt;&lt;/select&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="control-group"&gt; &lt;label class="control-label" style="white-space:nowrap;"&gt;Color Scheme&lt;/label&gt; &lt;div class="controls"&gt; &lt;select data-bind="options:ColorSchemes,optionsText:'Title',optionsValue:'Value',value:selectedColorValue"&gt;&lt;/select&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="control-group"&gt; &lt;div class="controls"&gt; &lt;label class="checkbox"&gt; &lt;input type="checkbox" data-bind="checked:withFaces" /&gt; Show Faces &lt;/label&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="control-group"&gt; &lt;label class="control-label"&gt;Width&lt;/label&gt; &lt;div class="controls"&gt; &lt;input type="text" id="fbWidth" data-bind="value:width, valueUpdate:'afterKeyDown'" /&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>I changed width input but It doesnt work in fb-button.What I'm missing. Thanks your suggestions...</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload