javascript - Accessing 'this' table cells value -
i have form, after form has been filled , add button pressed - values form pouchdb , table in browser. need make "edit" option. idea is:
<td ondblclick='updatevaucher()' style='cursor: pointer'>"+data[i].doc.vaucherid+ "</td>
now question is: how value of cell (which id) download rest of information form?
i that:
function updatevaucher(){ var mydoc = this.td.value; ... }
to reference element inside function, can pass element event handler:
ondblclick='updatevaucher(this)'
you can content of element via innertext
or textcontent
(cross-browser):
function updatevaucher(ele){ var mydoc = ele.textcontent || ele.innertext; ... }
Comments
Post a Comment