wood burning stoves*
The moose likes HTML, CSS and JavaScript and the fly likes jQuery - For Loop question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "jQuery - For Loop question" Watch "jQuery - For Loop question" New topic
Author

jQuery - For Loop question

Nakataa Kokuyo
Ranch Hand

Joined: Jul 24, 2011
Posts: 184
Good day,

I have an array('checkComponents ') which holding list of textbox input id, and i want to iterate it to get the user value that have been type but seem i didn't get my luck on it.



question : how to used jQuery to get user input value from an array that holding input component id?

Appreciated your help on this !
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61092
    
  66

I'd use jQuery.map().


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Nakataa Kokuyo
Ranch Hand

Joined: Jul 24, 2011
Posts: 184
Thanks Bear and that's a good function, here is what i try but i get the value of "undefine"

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61092
    
  66

You're not forming the selector correctly from the id values.

Also, alert is a dinosaur. At least open a JavaScript console and use console.log().
Nakataa Kokuyo
Ranch Hand

Joined: Jul 24, 2011
Posts: 184
Thanks Bear for the clue
Nakataa Kokuyo
Ranch Hand

Joined: Jul 24, 2011
Posts: 184
one extra question Bear, if we using console.log() , is it compatible to all browser and it won't caused any exception ?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61092
    
  66

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61092
    
  66

Nakataa Kokuyo wrote:one extra question Bear, if we using console.log() , is it compatible to all browser and it won't caused any exception ?

It's not something that you'd leave in your code, just like you wouldn't leave in any debug alerts.

All modern browsers support some sort of JavaScript console, but a reference to console can fail if it's disabled (which it will be for most users).
Nakataa Kokuyo
Ranch Hand

Joined: Jul 24, 2011
Posts: 184
Thanks again Bear, is there a chance to turn on the console automatically if it was off (probably from code call) ? the debug message is somehow useful when complicated JS function applied.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61092
    
  66

No.

Would you really want the JavaScript console to pop open on a user whenever they visit your page?
Nakataa Kokuyo
Ranch Hand

Joined: Jul 24, 2011
Posts: 184
make sense Bear , thanks again !
 
Don't get me started about those stupid light bulbs.
 
subject: jQuery - For Loop question