Created
October 11, 2015 08:44
-
-
Save vlas-ilya/d3f1bee1e06eb06efb89 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Test Select form Matreshka</title> | |
| <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> | |
| <link href="http://cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/css/select2.min.css" rel="stylesheet" /> | |
| <script src="http://cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/js/select2.min.js"></script> | |
| <script src="http://cdn.jsdelivr.net/matreshka/latest/matreshka.min.js"></script> | |
| </head> | |
| <body> | |
| <select multiple="multiple" id="mSelect" width="200px"> | |
| <option>1</option> | |
| <option>2</option> | |
| <option>3</option> | |
| <option>4</option> | |
| <option>5</option> | |
| </select> | |
| <span type="text" id="selectSpan"/> | |
| <script type="text/javascript"> | |
| $(document).ready(function () { | |
| $("#mSelect").select2(); | |
| var mk = new Matreshka; | |
| mk.bindNode('x', '#mSelect', { | |
| on: 'change', | |
| getValue: function () { | |
| return $("#mSelect").select2('val'); | |
| }, | |
| setValue: function (v) { | |
| return $("#mSelect").select2('val', v); | |
| } | |
| }); | |
| mk.bindNode('x', '#selectSpan', Matreshka.binders.innerHTML()); | |
| }); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment