JSFiddle - React, Tailwind, and code Playground

by olli

HTML

<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0b2/jquery.mobile-1.0b2.min.css">
<script src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0b2/jquery.mobile-1.0b2.min.js"></script>
<!DOCTYPE html> 
<html> 
    <head> 
        <meta charset="utf-8"> 
        <title>Test</title> 
    </head> 
    <body>        
        <div data-role="page" id="a">
            <div data-role="header">
                <h1>Test</h1>
            </div>
            <div data-role="content" id="content">
                <a id="link_unbind">unbind change event</a><br/>
                <a id="link_bind">bind change event again</a>
                
                <div data-role="fieldcontain">
                    <label for="slider">Select slider:</label>
                    <select name="slider" id="slider" data-role="slider">
                        <option value="off">Off</option>
                        <option value="on">On</option>
                    </select> 
                </div>
            </div>
        </div>
    </body>
</html>

JavaScript

$(document).ready(function() {
    $('#slider').bind('change', function() {
        console.log('changed');
    });
    $('#link_unbind').bind('click', function() {
        $('#slider').unbind('change');
        console.log('unbind done');
    });
    $('#link_bind').bind('click', function() {
      $('#slider').bind('change', function() {
        console.log('changed');
      });
      console.log('bind done');
    });
});