Link to home
Start Free TrialLog in
Avatar of joyacv2
joyacv2Flag for Puerto Rico

asked on

jQuery move one up and then one right

Hi,

I have the following table:

<tr><td class="colorFondoYCentrado"><input class="nombres" type="text" placeholder="NOMBRE"></td>
    	<td class="colorFondoYCentrado">director</td><tr>

Open in new window


then have the following code:

$('.nombres').focusout(function(){
		
		console.log(...)
		})

Open in new window




i need to obtain the value "director" to the console log. I try using $(this). with parent() and children() and eq() in many combinations but i don't know how to reach the value inside this td. Is like move one up to the td and then obtain the value of the adjacent td. Any idea?
Avatar of Rainer Jeschor
Rainer Jeschor
Flag of Germany image

Hi,
please try this:
$('.nombres').focusout(function(){
		console.log($(this).closest('tr').find('td.colorFondoYCentrado').text());
});

Open in new window

HTH
Rainer
Avatar of joyacv2

ASKER

Hi,

can you provide a solution without using the class of colorFondoYCentrado? because maybe i will not use this class
ASKER CERTIFIED SOLUTION
Avatar of Rainer Jeschor
Rainer Jeschor
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of joyacv2

ASKER

WORKS PERFECT!