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;   ... } 

learn more event handling in browser.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -