Element ID in modals working only once

I’m doing a profile page with informations, where you can change some of them with a modal.
It actually works, but I want to do some controls that block the end button in the modal if some of the strings are too long or too short. The controls are working, but the button is blocked only the first time i open the modal. Afetr i close the modal if i reopen it the element of the button is taken, but it doesn’t add the class blocked when needed. I did some console.log and it actually takes the element, but the class isn’t working anymore. I hope someone knows what’s happening.

Excuse me for my bad english :grin: