Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function(){
- $('#bags_table tr').click(function() {
- alert(1)
- alert($(this).attr('id')); //trying to alert id of the clicked row
- });
- });
- function bags_table_func(result){
- var rows = "<tr><th>Seal No.</th><th>Status</th><th>Destination</th><th>Total Packets</th><th>Max. Weight</th>" +
- "<th>Min. Weight</th><th>Avg. Weight</th><th>Total Weight</th></tr>"
- for (var obj in result){
- if (obj == 'last_bagged_on'){
- continue
- }
- else if (result[obj]['status'] == undefined){
- rows += "<tr><td>No Content</td></tr>"
- break
- }
- rows += "<tr id = '"+obj+"'><td>" + obj+"</td><td>" + result[obj]["status"] + "</td><td>" +
- result[obj]["destination"] + "</td><td>" + result[obj]["total_packets"] + "</td><td>" +
- result[obj]["max_weight"] + "</td><td>" + result[obj]["min_weight"] + "</td><td>" +
- result[obj]["avg_weight"] + "</td><td>" + result[obj]["total_weight"] + "</td><td><a href = '#'>Details</td></tr>"
- }
- $("#bags_table").html(rows);
- }
- $(document).on('click','#bags_table tr',function() {
- alert(1)
- alert($(this).attr('id')); //trying to alert id of the clicked row
- });
- $(document.body).on('click','#bags_table tr',function () {
- alert(1)
- alert($(this).attr('id')); //trying to alert id of the clicked row
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement