JSFiddle - React, Tailwind, and code Playground

HTML

<form id="test_form" method="POST">
    <input type="text" name="test" value="11">
    <input type="submit">
</form>

JavaScript

$('<input>').attr({
    type: 'checkbox',
    name: 'd1',
    checked: true
}).appendTo($('#test_form'));
$('<input>').attr({
    type: 'checkbox',
    name: 'd2'
}).appendTo($('#test_form'));

$('#test_form').submit(function (e) {
    alert($('#test_form').serialize());
    
    e.stopPropagation();
    return false;
});