Last active
September 6, 2016 12:21
-
-
Save j4ckth3r1pp3r/37cafcbdfba4e09ce556fa1d45b0bd06 to your computer and use it in GitHub Desktop.
My functions for WP
This file contains 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
/* | |
** Помечает указанное ACF поле в админке неактивным, при отмеченном выбранном ACF чекбоксе | |
*/ | |
function disableField (check, field) { | |
//check - имя чекбокса ACF | |
//field - имя поле ACF, который будет отключаться | |
check = $('div[data-name="'+check+'"] input[type="checkbox"]'); | |
field = $('div[data-name="'+field+'"] input'); | |
if (check.prop('checked')) { | |
field.prop("disabled", true); | |
} else { | |
field.prop("disabled", false); | |
} | |
check.change(function(){ | |
if (field.prop('disabled')) { | |
field.prop("disabled", false); | |
} else { | |
field.prop("disabled", true); | |
} | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment