Skip to content
Advertisement

how to Remove last selected value

I am trying to add values with the help of jquery But last value + in code again and again

The last value should be cleared when select new value from dropdown

JavaScript
JavaScript

Advertisement

Answer

I think you mean this

  1. newContent += $("#addedchild1"). is not doing what you think it is
  2. There is no content declared
  3. You do not need to remove anything if you use .html() it replaces the HTML

I think you do not want addedChild1 but all the added children in the div I gave ID=”wrapper” – if you want to nest in a addedChild, just change #wrapper to #addedChild1

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement