#Can someone guide me how to make this form next to the clicked btn?
6 messages · Page 1 of 1 (latest)
Try with position: fixed;
You will need to get the button's offset through getBoundingClientRect() and then use its values (top, left) to align the modal's position.
im coding it with only js,html,css
Yes,
Here's an example
const button = document.querySelector('#my-button');
const modal = document.querySelector('#modal');
button.addEventListener('click', function() {
modal.style.position = 'absolute';
// Position the modal card element
const buttonRect = button.getBoundingClientRect();
modal.style.top = buttonRect.top + buttonRect.height + 'px';
modal.style.left = buttonRect.left + 'px';
});