Answer the question
In order to leave comments, you need to log in
How to nicely access parent this in jquery?
A snippet like this:
$('.exapmle-1 input').keyup(function()
{
var value = $(this).val();
$(this).parent().parent().find('td:gt(0)').each(function()
{
console.log(value);
});
});
Answer the question
In order to leave comments, you need to log in
It is possible, but it will not be better:
$('.exapmle-1 input').keyup(function()
{
var f = function() {
console.log($(this).val());
};
$(this).parent().parent().find('td:gt(0)').each(f.bind(this));
});
$('.exapmle-1 input').keyup ->
$(this).parent().parent().find('td:gt(0)').each =>
console.log $(this).val()
return
$('.exapmle-1 input').keyup ->
$(this).parent().parent().find('td:gt(0)').each !~>
console.log $(this).val()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question