Lange offers a kit to retrofit latches to your YJ hardtop:
https://www.quadratec.com/products/13022_00.htm. I haven't used it but it may work to secure a YJ hardtop to a TJ.
I don't know if you've had the Jeep long enough to know if the top leaks, but since the YJ top doesn't mate well with the top of the TJ windshield, many people experience high wind noise or leaks at that joint, and/or water leaks at the top front of the doors. Your photo shows how the top doesn't fit correctly:
View attachment 149792
A web search will turn up information showing how to modify the YJ hardtop so it fits the TJ windshield better.