jQuery: The Write Less, Do More JavaScript Library

Selectors question

View: New views
2 Messages — Rating Filter:   Alert me  

Selectors question

by smokinguns :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hey all,
I'm new to jQuery and I have a  scenario:
I have a page that contains an iframe. The page in this iframe
contains  a table and the last column of every row has a textbox. Each
textbox has an unique id of the form tb_rowNum(tb_1,tb_2 etc.).  Each
row also has some hidden input elements. I'm accessing these textboxes
for processing. Right now, this is how I'm doing it:

[code]
var inputs=jQuery("#myiframe").contents().find('input[id*=tb_]');
 for(x=0;x<inputs.length;x++){
                               some processing ....
   }

[/code]

Is this an efficient approach or carries some overhead? Is there a
better way?


Re: Selectors question

by Cesar Sanz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I have not found another way to retrieve information from an iframe.

BTW, I see no problem using that sintax

----- Original Message -----
From: "smokinguns" <sameer.spadhye@...>
To: "jQuery (English)" <jquery-en@...>
Sent: Thursday, July 02, 2009 3:07 PM
Subject: [jQuery] Selectors question


>
> Hey all,
> I'm new to jQuery and I have a  scenario:
> I have a page that contains an iframe. The page in this iframe
> contains  a table and the last column of every row has a textbox. Each
> textbox has an unique id of the form tb_rowNum(tb_1,tb_2 etc.).  Each
> row also has some hidden input elements. I'm accessing these textboxes
> for processing. Right now, this is how I'm doing it:
>
> [code]
> var inputs=jQuery("#myiframe").contents().find('input[id*=tb_]');
> for(x=0;x<inputs.length;x++){
>                               some processing ....
>   }
>
> [/code]
>
> Is this an efficient approach or carries some overhead? Is there a
> better way?
>