I have a select element which I'm creating through javascript (DOM)
var cell_stock_id = row.insertCell(0);
var cell_stock_id_sel = document.createElement('select');
I have kept an onchange javascript function for this-
cell_stock_id_sel.setAttribute("onchange","populateOtherFields");
The function gets called when i change the selected option in select.
Is there a way I can pass an argument to this function "populateOtherFields" ?
I have a select box and a lot of text fields in a table row. I want to populate those rows based on the selection. I'm able to access the data which has to be inserted in those fields, but I don't know how to enter the data in those textfields for that row. I'm thinking of passing a unique number which will identify with the names of the elements in a row, and the javascript will parse that pattern in the names of the elements of the row.
document.forms["0"].elements[i].name.indexOf("pattern").
So is there a way by which i can pass this "pattern", which is essentially the iteration (no. of rows, row number) number.
select__1, text__1, text2__1
select__2, text__2, text2__2
The '__1' , and the '__2' need to be passed. And they're not static patterns. Could be any number.