Methods
-
findOnce(id, fnopt)
-
Filters elements that have already been processed once.
Parameters:
Name Type Attributes Description id
string A required string representing the name of the data id which should be used when filtering the elements. This only filters elements that have already been processed by the once function. The id should be the same id that was originally passed to the once() function. fn
function <optional>
(Optional) If given, this function will be called for each element that has not yet been processed. The function's return value follows the same logic as $.each(). Returning true will continue to the next matched element in the set, while returning false will entirely break the iteration. - Source:
Returns:
jQuery element collection of elements that have been run once. -
once(idopt, fnopt)
-
Filters elements by whether they have not yet been processed.
Parameters:
Name Type Attributes Description id
string | function <optional>
(Optional) If this is a string, then it will be the data ID used to determine whether it has already been processed or not. If the id parameter is a function, it will be passed off to the fn parameter and the id will become a unique identifier, represented as a number. When the id is neither a string or a function, it becomes a unique identifier, depicted as a number. The element's data ID will then be represented in the form of "jquery-once-#". fn
function <optional>
(Optional) If given, this function will be called for each element that has not yet been processed. The function's return value follows the same logic as $.each(). Returning true will continue to the next matched element in the set, while returning false will entirely break the iteration. - Source:
Returns:
jQuery element collection of elements that have now run once. -
removeOnce(id, fnopt)
-
Removes the once data from the given elements, based on the given ID.
Parameters:
Name Type Attributes Description id
string A required string representing the name of the data id which should be used when filtering the elements. This only filters elements that have already been processed by the once function. The id should be the same id that was originally passed to the once() function. fn
function <optional>
(Optional) If given, this function will be called for each element that whose element's once data was removed. The function's return value follows the same logic as $.each(). Returning true will continue to the next matched element in the set, while returning false will entirely break the iteration. - Source:
Returns:
jQuery element collection of elements that now have their once data removed.