So, Im creating a HTML file which has buttons with labels like: First Name, Last name, etc
I need to program the button so that when user clicks it the Fist name button should go away and in the <div>
you instead see the name "John Doe"
I've created this in my .js file:
// create a JavaScript object here with the following fields: firstName, lastName, jobTitle, homeOffice
var demo = {
firstName : "Waseem",
lastName : "Qazi",
jobTitle : "Traveler Care",
homeOffice : "Penn. field",
tellMeMore : "Exicted to re-start my coding adventure again. Been a while
since I had coded. Looking forward to all the learning and growth this
amazing oppportunity will present."
givefirstname : function() {
return this.firstName;
};
using jQuery and the object above, display the information as the appropriate button is clicked.
How do I call this in HTML file so that each function gives the corresponding data back on the screen?
my call line in HTML file:
<li>
<a class="selected" href="">
<button type="button" onclick=demo.givefirstname>
First Name
</button>
</a>
</li>
<br>