JSFiddle - React, Tailwind, and code Playground

by billccn

HTML

<form action="#">
    <input id="d" type="checkbox" />
    <input id="a" type="submit" value="first" />
    <input id="b" type="text" />
    <input id="c" type="submit" value="second" />
</form>
<textarea rows="10"></textarea>

JavaScript

$('#d').click(function() {
    $('#a').prop('disabled', this.checked);
});

$('input[type="submit"]').click(function() {
    $('textarea').text($('textarea').text() + this.id + ' clicked!\n');
});

$('#b').keydown(function(e) {
    if (e.which === 10 || e.which === 13) {
        $('form').submit();
        $('#c').prop('disabled', true);
    }
});

$('form').submit(function() {
    $('textarea').text($('textarea').text() + 'submitted\n');
    return false;
});