SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Feb 2013
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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.

  2. #2
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,312
    Mentioned
    177 Post(s)
    Tagged
    8 Thread(s)
    Hi there,

    Welcome to the forums

    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.

  3. #3
    SitePoint Member
    Join Date
    Feb 2013
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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 !

  4. #4
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,312
    Mentioned
    177 Post(s)
    Tagged
    8 Thread(s)
    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?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •