Skip to content

Instantly share code, notes, and snippets.

@JeancarloFontalvo
Created January 28, 2019 23:06
Show Gist options
  • Save JeancarloFontalvo/02dd09dd2e4ad338d4a3dd784f0b5422 to your computer and use it in GitHub Desktop.
Save JeancarloFontalvo/02dd09dd2e4ad338d4a3dd784f0b5422 to your computer and use it in GitHub Desktop.
Append a label next to each checkboxes
var checkboxes = $('input[type="checkbox"]');
checkboxes.each((item, element) => {
element = $(element);
var value = element.is(":checked");
element.after(`<span class='text-white label label-${value ? "primary": "danger"}'>${value ? "SI": "NO"}</span>`);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment