JSFiddle - React, Tailwind, and code Playground

by IgorMinar

HTML

<script src="http://code.jquery.com/jquery-1.6.4.js"></script>

<input type="checkbox" name="test" checked>

<hr>
<pre id="output"></pre>

JavaScript

var checkBox = $('input[name=test]'),
    output = $('#output'),
    checked;

log('1', 'checked', checkBox.attr('checked'));
checkBox.click();
log('2', undefined, checkBox.attr('checked'));


function log(testNo, expected, actual) {
    expected = (expected !== undefined) ? '"' + expected + '"' : expected;
    actual = (actual !== undefined) ? '"' + actual +'"' : actual;
    output.append(testNo + ': expecting checked to be ' + expected + ', was ' + actual + '\n');
};