Display a new member to an html display list in javascript -
i want display new member html display. i'm working json object array. have 2 functions, 1 displays list in memberslist , supposed push single member list. i'm not clear on i'm doing wrong, maybe way i'm passing (or not) function? i'm getting [object][object] in list ... see jsfiddle: http://jsfiddle.net/lakenney/njndcyqm/
// display members list inside id 'memberslist' on html page function displaymembers() { //console.log("dislpaying members"); var len = members.length; var memberslist = document.getelementbyid('memberslist'); memberslist.innerhtml += ''; // loop through each member object in array, , print each element (member string) pge (var = 0; < len; i++) { //console.log(members[i]); // members memberslist.innerhtml += members[i] + '<br>'; } //console.log(members); } /* functions displays single member on page. * * @param member - single member members array */ function displaymember(member) { // html memberslist // var memberslist = document.getelementbyid('memberslist'); // console.log("display members list:" + memberslist); // declare string hold member var mymember = member.memberfirstname.value + ' ' + member.memberlastname.value + ' ' + member.memberemail.value; // what's in mymember? console.log("what's in mymember:" + mymember); members.push(mymember); //console.log("this memberslist" + members); }
you're trying insert object html. trying in c#: txtfirstname.text = personobject;
doesn't work way. have this:
memberslist.innerhtml += '<div>' + members[i].memberfirstname + '<div>' + '<br>';
Comments
Post a Comment