iterating through parent fb objects

Page: 1

Author Post
Member
Registered: Jan 2011
Posts: 3
I am opening the fb via:

fb.start(URL, "caption:my caption");

In the iframe, I have a click event that should iterate through the text fields on the parent. I am using the following:

$('#finished').click(function () {
parent.fb.$('input[type="text"]').each(function () {
alert(this.id);
});
return false;
});

Is it possible to reference the parent fields in such a manner?
Member
Registered: Jan 2011
Posts: 3
Forgot to mention that I am getting the following error in the click function:

Uncaught TypeError: Cannot call method 'each' of null

cmsturg wrote
I am opening the fb via:

fb.start(URL, "caption:my caption");

In the iframe, I have a click event that should iterate through the text fields on the parent. I am using the following:

$('#finished').click(function () {
parent.fb.$('input[type="text"]').each(function () {
alert(this.id);
});
return false;
});

Is it possible to reference the parent fields in such a manner?
Administrator
Registered: Aug 2008
Posts: 3382
The Floatbox library and API is not jQuery. Floatbox's fb.$ function is not jQuery's $ function. It does not take a css selector as its argument. It takes an id string. In your use of it, it is returning null because there is no element available that has the requested id of ('input[type="text"]'. Please see the details of Floatbox's API, including fb.$, in the API Reference.

The returned value from a successful fb.$ call is a node element, not an array as is the case with jQuery's $. There is no "each" function attached to that returned node element.

Your problems have nothing to do with referencing the parent name-space, but everything to do with using the Floatbox fb.$ function as if it was the jQuery $ function.

Page: 1