javascript - Find a TD closest to a Parent Div of a submit button -
i'm trying key
attribute of <td>
tag below html code.
<td class="xedit editable editable-click editable-open" id="3" key="details" data-original-title="" title="">javascript library </td> <div class="popover fade top in editable-container editable-popup" style="top: 289px; left: 534px; display: block;"> <div class="arrow"></div> <div class="popover-content"> <div> <div class="editableform-loading" style="display: none;"></div> <form class="form-inline editableform" style=""> <div class="control-group form-group"> <div> <div class="editable-input" style="position: relative;"> <input type="text" class="form-control input-sm" style="padding-right: 24px;"> <span class="editable-clear-x"> </span> </div> <div class="editable-buttons"> <button type="submit" class="btn btn-primary btn-sm editable-submit"> <i class="glyphicon glyphicon-ok"> </i> </div> </div> </div> </form> </div>
jquery used :
var x = $(this).closest('div').find('.editable-container').closest('td').attr('key'); //doesn't work var x = $(this).closest('td').attr('key'); //doesn't work
try use:
var x = $(this).closest('.editable-container').prev().attr('key');
Comments
Post a Comment