Created
January 28, 2019 23:06
-
-
Save JeancarloFontalvo/02dd09dd2e4ad338d4a3dd784f0b5422 to your computer and use it in GitHub Desktop.
Append a label next to each checkboxes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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