-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
45 lines (31 loc) · 1.15 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
$(document).ready(function () {
$("#btn").click(function(){
$.getJSON("list.json", function (data) {
var lists = '';
// ITERATING THROUGH OBJECTS
$.each(data, function (key,value) {
//CONSTRUCTION OF ROWS HAVING
// DATA FROM JSON OBJECT
lists += '<tr>';
lists += '<td>' +
value.SlNo + '</td>';
lists += '<td>' +
value.Name + '</td>';
lists += '<td>' +
value. Quantity + '</td>';
lists += '<td>' +
value.Unit + '</td>';
lists += '<td>' +
value.Department + '</td>';
lists += '<td>' +
value. Notes + '</td>';
lists += '</tr>';
});
//INSERTING ROWS INTO TABLE
$('#table').append(lists);
var tdata= document.getElementsByTagName("tr");
tdata[0].style.color="yellow";
});
document.getElementById("btn").disabled=true;
});
});