A structured way to use AxQuery to select child elements?

Hi folks,

I’ve been searching the forums and web but have been unable to find a clear answer to this: is there a way to reference a widget scoped by parent?

In my case I have the structure:
Page
DynamicPanel1
Widget
DynamicPanel2
Widget

I know that just using ‘Widget’ won’t allow me to select between the two objects with the same name. I’m hoping that there is some sort of pattern that could be used in JavaScript like:
$axure(’@Page.DynamicPanel2.Widget’).text(‘hello world’);

Is there any mechanism to add specificity the the AxQuery selector?

Thanks,
Reeves

Any reason you can’t name the widget with a unique name and just select it directly? That would be easiest.

Alternatively, you can use jQuery’s children() method.

$axure('@parent').jQuery().children()

This should get you the direct children of the parent. You can continue to traverse the DOM to get to the element you want.

1 Like

Yeah, that’s what I’m resigned to doing at this point. The reason I ask is I have a set of like objects that I just want to duplicate and name the parents. Instead I’ll have to duplicate, then uniquely name each of the children.

I have 5 objects, each with 7 children. I was hoping that there was a way to uniquely name 5 things instead of 35. In the grand scheme of things, however, it’s a prototype and it won’t need to be maintained.

Thanks for that, that seems to be a reasonable alternative. For a future prototype I will use that to programatically find the children.

Cheers,
Reeves