Skip to content

Instantly share code, notes, and snippets.

@Fobiya
Last active June 25, 2020 01:38
Show Gist options
  • Save Fobiya/0306cbc720b9d6a25588585aae24554c to your computer and use it in GitHub Desktop.
Save Fobiya/0306cbc720b9d6a25588585aae24554c to your computer and use it in GitHub Desktop.
checkbox
$('.check').click(function(){
this.value = (this.value)?'':this.dataset.check;
});
$( document ).ready(function() {
$('input[type="checkbox"]').click(function() {
if ($(this).val() === '') {
$(this).val($(this).data("check"));
} else {
$(this).val("");
};
});
});
$( "select" ) .change(function () {
$('select option').val('');
$( "select option:selected" ).each(function() {
$(this).val($(this).data("select"));
});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment