onchange event code for grids

trying to add an .onchange event to a field in a grid, but it doesn’t seem to fire.

this is the url: (master/detail edit)
workorderheaderedit.php?showdetail=workorderdetail&id=10007

i’ve tried adding to:
workorderdetalgrid.php
workorderdetaledit.php

as:

loadjs.ready(“load”, function() {

// Startup script
console.log(“page loaded”);
$(‘#x_quantity’).on(‘keyup keypress blur change’, function(e) {
var qty = $(“#x_quantity”).val();
var item_cost = $(“#x_unit_price”).val();
var line_ttl = (qty * item_cost);

line_ttl = parseFloat(line_ttl).toFixed(2);
$(“#x_extended”).val(line_ttl);
});
});

i don’t even see the ‘page loaded’ event fire, as well as anything for the grid portion of the form

not sure where to add the code.

thxs

correction
the page workorderdetailgrid.php di load, but the event code is not firing…

ok appears each row is a unique id value for the item on the grid

row 1: x1_quantity
row 2: x2_quantity
row 3: x3_quantity
etc…

is there a call to get the current row the cursor is on, so the calcs can be performed ?

I understand what’s going on:

how do you set:

$(‘#x1_quantity’).on(‘keyup keypress blur change’, function(e) {}

to listen to any of the rows in the grid??

thanks

You better use Client Side Events, see Field Setup → Client Side Events in the help file. It will add events to all rows in the grid.