I have some buttons with ids: ok_1, ok_2, ok_3...
How to click all buttons with ids that start with ok_ using javascript?
Use an attribute selector that checks for prefix (^=):
document.querySelectorAll('[id^="ok_"]').forEach(btn => btn.click());