This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have David & Dawn Griffiths on-line!
See this thread for details.
Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

How to dynamically add or Remove a Div in HTML page

 
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there

Here is my code
http://jsfiddle.net/vngx/4t9hfs39/1/

What I want is onClick of add a new block of same data(name of org,Role,Year...) will be add and there is a button that will remove that block..


Don't know how to acheieve this any help?

Thanks
 
Sheriff
Posts: 67595
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Kishor Joshi wrote:Don't know how to acheieve this any help?


Actually, it looks like you do know how to achieve it as you are using the jQuery append() and remove() methods.

So what's the actual problem?
 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have try append() and remove() method but I have not acheive what I want?

Are you clear from my Problem statements what I want ?or do I need to clear myself?


EDIT:
Check my updated code of Jsfiddle.net
 
Bear Bibeault
Sheriff
Posts: 67595
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Kishor Joshi wrote:or do I need to clear myself?


You need to ShowSomeEffort. You haven't told us what the problem is except that you don't know how to "achieve it", but your code shows that you actually do know how to achieve it. So what is the real problem?

Are there errors messages on the console? Have you set breakpoints to see if your code is getting called at the right times? If so, are the variables containing the correct values? Do your jQuery selectors actually return what you expect?

These are the typed of debugging steps you need to take.
 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok Let me explain what I want to acheive

This is a Simple HTML file



What I want is when a User has click on Button add then a Same New Block will be add at the Bottom So I am using this code



But I am not able to acheive it
How to do this?

 
Bear Bibeault
Sheriff
Posts: 67595
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please answer the questions I posed in my earlier response. These will help us (and you) try to figure out where the problem lies.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is no div as a parent. Wrap the two new elements in a div and your code would work.



 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
somehow after reading a lot of thread I have solved it by using prepend(),append() method of jQuery and javaScript
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic