Try to use:
$(this).closest('tr').find('.count').text(limit);
You don't need to convert .count
to jQuery object inside .find()
method. You also need to put .text()
outside of .find()
문제
I am new to jQuery and hope someone here can help me with this:
Basically what I am trying to do is the following:
limit
" and get their maxlength
.count
" in the same row.I am using the following but this displays the last maxlength for all the elements in question. My guess is that my last element is perhaps overwriting the others. Can someone tell me what I have to change here ?
var limit = '';
$('.limit').each(function() {
limit = $(this).attr('maxlength');
$(this).closest('tr').find($('.count').text(limit));
});
Many thanks in advance, Mike.
해결책
Try to use:
$(this).closest('tr').find('.count').text(limit);
You don't need to convert .count
to jQuery object inside .find()
method. You also need to put .text()
outside of .find()