asp.net web api - Pushing an item into array in javascript -
i got problem javascript. specificly, have table like
<table class="table"> <tr> <th> <label>select</label> </th> <th> @html.displaynamefor(model => model.firstname) </th> <th> @html.displaynamefor(model => model.middle) </th> <th> @html.displaynamefor(model => model.lastname) </th> <th> @html.displaynamefor(model => model.dob) </th> <th> @html.displaynamefor(model => model.gender) </th> <th> @html.displaynamefor(model => model.startdate) </th> <th></th> </tr> @foreach (var item in model) { <tr id="@html.displayfor(modelitem => item.employeeid)" ondblclick="doubleclickonrow(this)"> <td> <input id="@html.displayfor(modelitem => item.employeeid)" type="checkbox" onclick="selectcheckbox(this)"/> </td> <td> @html.displayfor(modelitem => item.firstname) </td> <td> @html.displayfor(modelitem => item.middle) </td> <td> @html.displayfor(modelitem => item.lastname) </td> <td> @html.displayfor(modelitem => item.dob) </td> <td> @html.displayfor(modelitem => item.gender) </td> <td> @html.displayfor(modelitem => item.startdate) </td> </tr> } </table>
and declare array hold employeeid checking checkbox in first column of row. however, says arrayofemployeeid.push(id); not function. way, want array of employeeid delete methods in asp.net web api. right?
var arrayofemployeeid = {}; function selectcheckbox(thisrow) { var id = thisrow.id; arrayofemployeeid.push(id); console.log(arrayofemployeeid); }
arrayofemployeeid
object ({}
). want array var arrayofemployeeid = [];
.
Comments
Post a Comment