Skip to content

Instantly share code, notes, and snippets.

@chdenat
Last active May 26, 2021 17:13
Show Gist options
  • Save chdenat/c869409ca80cee64e6de443bb2b8b02d to your computer and use it in GitHub Desktop.
Save chdenat/c869409ca80cee64e6de443bb2b8b02d to your computer and use it in GitHub Desktop.
There was no method to clear all the rows of a repeater ... This is a new Field prototype method
/**
* empty function for acf.Field ie, it clears all the existing rows
*
* Only for repeater
*
* @returns {boolean}
*
* @author : Christian Denat
* @email : [email protected] / [email protected]
*
* @date : 20210526
*
*/
acf.Field.prototype.empty = function() {
if ('repeater' !== this.type) {
return false;
}
this.$('tbody:first tr:not(.acf-clone)').empty();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment