Created
June 24, 2024 06:54
-
-
Save hazratbilal0079/3c0d7af25aa4b2df040243aecb30cb55 to your computer and use it in GitHub Desktop.
Hide Previous Repeater Fields while adding New in Edit with jQuery
This file contains hidden or 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
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> | |
<script> | |
jQuery(document).ready(function($) { | |
// Hide all existing rows when the page loads | |
$('.jet-form-builder-repeater__row').hide(); | |
// Attach a click event listener to the "Add New Comment" button | |
$('.jet-form-builder-repeater__new').on('click', function() { | |
// We need to wait for the new row to be added to the DOM | |
setTimeout(function() { | |
// Get the last added row (newly added) | |
var newRow = $('.jet-form-builder-repeater__row').last(); | |
// Show the newly added row | |
newRow.show(); | |
}, 100); // Adjust the timeout as necessary | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment