Hi i have a form in my application where user can put their details. My form portion looks like this,
in this when user click on add school hyperlink, i want all values appended into label like,
School: 12th
School Name: St. Xavier’s
School Location: Banglore
Class Year: 2010
Branch: Science
This should be appended any no of time when user click on add school hyperlink.
How can i do that using javascript/ jquery?
The values in the text boxes can be accessed by
document.getElementById('id').valueThe remaining should be easy for you to figure out.
Here’s how you could do it not using JQuery:
Add a
spanor div with the idresultwherever you want the result to show.Expand on the code above to display the other fields as well.
have a look at this:
http://jsfiddle.net/GQdsD/
innerHTMLoverwrites what was held in the HTML container before. You can do this:OR, collect the values in a JS var and then write it to the HTML container:
To allow multiple adds, change this line in your code:
To this, so it adds the new information to the old information: