jquery - find input field where type=text in the table row -


i have delete image that triggered 'click' handler. i'm passing element parameter function triggered event, delete image.

is there way can find input type="text" table row of delete image clicked?

here code i'm working with:

        a4j.ajax.addlistener({             onafterajax: function(req,evt,data) {                    j$('[id$=deleteimage]').on('click', function(elem) {                     console.log('the delete button clicked');                     console.log('************** before ' + localstorage.activebuttons);                     var activearray  = localstorage.activebuttons.split(',');                     var idx = activearray.indexof('account');                     if (idx > -1) activearray.splice(idx, 1);                     localstorage.activebuttons = activearray.join(',');                     console.log('************** after ' + localstorage.activebuttons);                 });                  var lastrow = j$('table[id$=participanttable] tbody tr:last');                                  var active = localstorage.activebuttons.split(',');                  var datarows = j$('tr.datarow');                 datarows.each(function(index, elem) {                     updateimages(elem, active[index]);                 });             }         }); 

i need find input[type="text"] in table row delete image clicked , id of input field , check if id contains 1 of following values: contact, user or account. need pass value contained in input id indexof() method.

thanks help.

try this:

j$(this).closest('tr').find('input[type="text"]:visible');

inside click handler

j$('[id$=deleteimage]').on('click', function(elem) {

jquery .closest() - get first element matches selector testing element , traversing through ancestors in dom tree.


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -