I am trying to iterate to the first ancestor containing the class ‘sys-form-row’.
I am able to get the row containing class="sys-form-row" using the following: objBack =
$('#txtMyBox2').parent().parent();
This seems incredibly clumsy. What I would like to do is something like this:
$('#txtMyBox2').parents('.sys-form-row');
or even $('#txtMyBox2').closest('.sys-form-row');
however both fail and my current approach will not always work if additional div nesting is applied.
Any help would be really appreciated.
closest
example should be the correct way to do this. As Shankar says, we need to see your HTML code. – Object{}
above the text box. This will format the content as code. – Object