How to add dynamic buttons using javascript

Hi all !! I have an application where i show the request in Accept ,user name and reject buttons created dynamically.But my problem is after the button is clicked ,the accept
name and reject should be hide.I used .hide() but since the buttons are created dynamically i dont know the id’s.

Hi there,

Welcome to the forums :slight_smile:

Would it not be possible to wrap the buttons in a div or span element (which you could give an ID to) then hide that instead.

If this doesn’t work for you, could you post a link to the page in question and I’ll have a closer look.

hi thank you for the reply,
I am putting the buttons in a div only.But i dont want to hide the whole div,just the button and related text (Accept joshna Reject).The remaining requests should not hide.Like in facebook !

You could select all the buttons based on a parent element (e.g. the div or in the form), then hide/show them based on another attribute, e.g. their name or their text.

If you would like any help with this, can you post a link?