2016-04-02 5 views
0

ここで私のコードは、ドロップダウンリストのselectionChangedイベントから発生した値を選択するときに発生しますが、このコードをサーバーselectionChangedイベントに発生させません。このため任意の代替がある私はに助けてください、私はこのsoutionがthis URLselectionChangedイベントがノックアウトで動作しないjs

**HTML Code** 

    <select data-bind="options: choices, value: selectedChoice"></select>  
    <select data-bind="event: { change: selectionChanged }"> 
     <option>A</option> 
     <option>B</option> 
     <option>C</option> 
    </select> 

**JS Code:** 

    var viewModel = { 
     choices: ["one", "two", "three"], 
     selectedChoice: ko.observable("two") , 
     selectionChanged: function(event) { 
      alert("the other selection changed"); 
     } 
    }; 

    viewModel.selectedChoice.subscribe(function(newValue) { 
     alert("the new value is " + newValue); 
    }); 


    ko.applyBindings(viewModel); 

答えて

0

から問題があなたのjsfiddle URLが固定されていたではなく使用されるスクリプトを発見しました。

あなたがに行く場合:http代わりにhttpsそれは

Mixed Content: The page at 'https://fiddle.jshell.net/rniemeyer/LBz6d/show/' was loaded over HTTPS, but requested an insecure script 'http://knockoutjs.com/downloads/knockout-2.2.1.debug.js'. This request has been blocked; the content must be served over HTTPS. 
+0

を動作するはずですが、私は自分のサーバーにこのコードを実行していますhttp://dev-sc8.corsair.com/en-us/memoryfinderそれがあります私のサーバでは動作しません –

+0

問題は別の場所にあるので、指定したコードが動作するはずです。あなたは完全なjsとhtmlファイルを表示できますか? – Timvr01

+0

は私のファイルですhttps://onedrive.live.com/redir?resid=143242B617BA6BE2!8464&authkey=!ALfhswMBsY8wTR8&ithint=folder%2caspx –

関連する問題