TellJohn TellJohn - 2 years ago 133
HTML Question

parent parent children children etc

Im trying to target a div outside of my Jquery button element. The way I'm doing it right now is


There must be and easier way? The element has a class but there are more identical elements I also need to adjust individually.



Answer Source

Maybe use something like:

$(this).closest('.pucontent').find('input.fontSize').val(); // You'll get font size.
// or
$('input.fontSize', $(this).closest('.pucontent')).val();

Read about .closest() and .find() or better read article about traversing in jQuery

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download