Created
June 14, 2023 23:47
-
-
Save chrisjangl/0e77a30717b4ebc4b4c5a5b3d0745b41 to your computer and use it in GitHub Desktop.
[WP Pizza] Lists the enabled ingredients in an ingredient group when on the WP Pizza Ingredients page, Custom Groups tab
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
// set this to the ID of the group | |
var group = document.querySelector('#wppizza_addingredients-custom-group-96'), | |
// setting this as a variable in case it changes in the future | |
ingredientClass = 'wppizza_addingredients_ingrcg_sortable'; | |
// find the ingredients that are enabled for this group | |
group.querySelectorAll('input[type="checkbox"]:checked').forEach(function(ingredient) { | |
// find the label for the ingredient | |
var label = ingredient.parentElement.innerText; | |
console.info(label); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment