JSFiddle - React, Tailwind, and code Playground
by Kevin Pliester
HTML
<form class="addCheckboxBefore">
<label>
Name<br>
<input type="text" placeholder="Name eingeben">
</label>
<label>
E-Mail<br>
<input type="email" placeholder="E-Mail eingeben">
</label>
<input type="submit" value="Senden">
</form>
CSS
label {
display: block;
margin-bottom: 15px;
}
JavaScript
(function($) {
const JC_AddCheckboxBefore = {
construct: function() {
this.initCheckbox();
},
initCheckbox: function() {
const checkboxHTML = "<label><input type=\"checkbox\" required> <span>Ich habe die <a href=\"/datenschutz\" target=\"_blank\">Datenschutzerklärung</a> gelesen und bin mit der Verarbeitung meiner Daten einverstanden.</label>";
$('.addCheckboxBefore').find("input[type='submit']").before(checkboxHTML);
},
};
$(JC_AddCheckboxBefore.construct());
})(jQuery)